Move multiple files from subfolders to one folder using CMD or Batch
I have files in subfolders which are in a folder structure is like this:
D:Folder_Source
D:Folder_Sourcefile1.txt
D:Folder_SourceFolderA
D:Folder_SourceFolderAfile1.txt
D:Folder_SourceFolderAfile2.txt
D:Folder_SourceFolderB
D:Folder_SourceFolderBfile3.txt
D:Folder_SourceFolderBfile4.txt
D:Folder_SourceFolderBfile8.txt
I want to move some txt
files in each subfolder to C:Destination
from a command prompt.
For example, the files I want to move are file1.txt
, file2.txt
, file8.txt
, etc.
If there is a file in the destination folder with the same name of the file from the source folder being copied, I want to keep both files and not overwrite the existing file.
I tried this which fails and does not give me the expected result:
move /s file1.txt file2.txt file8.txt C:Destination
Is something like this even possible from command line or a batch script?
windows command-line batch
add a comment |
I have files in subfolders which are in a folder structure is like this:
D:Folder_Source
D:Folder_Sourcefile1.txt
D:Folder_SourceFolderA
D:Folder_SourceFolderAfile1.txt
D:Folder_SourceFolderAfile2.txt
D:Folder_SourceFolderB
D:Folder_SourceFolderBfile3.txt
D:Folder_SourceFolderBfile4.txt
D:Folder_SourceFolderBfile8.txt
I want to move some txt
files in each subfolder to C:Destination
from a command prompt.
For example, the files I want to move are file1.txt
, file2.txt
, file8.txt
, etc.
If there is a file in the destination folder with the same name of the file from the source folder being copied, I want to keep both files and not overwrite the existing file.
I tried this which fails and does not give me the expected result:
move /s file1.txt file2.txt file8.txt C:Destination
Is something like this even possible from command line or a batch script?
windows command-line batch
add a comment |
I have files in subfolders which are in a folder structure is like this:
D:Folder_Source
D:Folder_Sourcefile1.txt
D:Folder_SourceFolderA
D:Folder_SourceFolderAfile1.txt
D:Folder_SourceFolderAfile2.txt
D:Folder_SourceFolderB
D:Folder_SourceFolderBfile3.txt
D:Folder_SourceFolderBfile4.txt
D:Folder_SourceFolderBfile8.txt
I want to move some txt
files in each subfolder to C:Destination
from a command prompt.
For example, the files I want to move are file1.txt
, file2.txt
, file8.txt
, etc.
If there is a file in the destination folder with the same name of the file from the source folder being copied, I want to keep both files and not overwrite the existing file.
I tried this which fails and does not give me the expected result:
move /s file1.txt file2.txt file8.txt C:Destination
Is something like this even possible from command line or a batch script?
windows command-line batch
I have files in subfolders which are in a folder structure is like this:
D:Folder_Source
D:Folder_Sourcefile1.txt
D:Folder_SourceFolderA
D:Folder_SourceFolderAfile1.txt
D:Folder_SourceFolderAfile2.txt
D:Folder_SourceFolderB
D:Folder_SourceFolderBfile3.txt
D:Folder_SourceFolderBfile4.txt
D:Folder_SourceFolderBfile8.txt
I want to move some txt
files in each subfolder to C:Destination
from a command prompt.
For example, the files I want to move are file1.txt
, file2.txt
, file8.txt
, etc.
If there is a file in the destination folder with the same name of the file from the source folder being copied, I want to keep both files and not overwrite the existing file.
I tried this which fails and does not give me the expected result:
move /s file1.txt file2.txt file8.txt C:Destination
Is something like this even possible from command line or a batch script?
windows command-line batch
windows command-line batch
edited Jan 23 at 21:45
Pimp Juice IT
24.1k113973
24.1k113973
asked Jan 18 at 23:17
Lutfi CreativesysLutfi Creativesys
163
163
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can use a batch script and set three variables in it with one being the path to the root source directory which will be traversed for specific files, the second being the destination path where the new files will be copied, and the third being a file list of the file names you wish to copy to the destination directory.
With these three variables you can use a FOR /R
loop to traverse the source location and use conditional IF
logic to check whether or not files already exist for whatever copy or delete operation needs to be performed with each file. Furthermore you can use a CALL
and variable substitutions to pass the parts of the file name to another routine and use additional IF
logic along with SET /A
to increment the duplicate file number, etc.
Batch Script
@ECHO OFF
SET "source=C:Folder_Source"
SET "dest=C:Destination"
SET "FileList=file1.txt file2.txt file8.txt"
SET "dupCnt=1"
FOR /R "%source%" %%A IN (%FileList%) DO (
IF NOT EXIST "%dest%%%~NXA" (
XCOPY /F /Y "%%~FA" "%dest%" && IF EXIST "%%~FA" DEL /Q /F "%%~FA"
) ELSE (
CALL :DupeRoutine "%%~FA" "%%~NA" "%%~XA"
)
)
GOTO :EOF
:DupeRoutine
IF EXIST "%dest%%~2_(%dupCnt%)%~3" (
SET /A dupCnt=%dupCnt%+1
CALL :DupeRoutine "%~1" "%~2" "%~3"
) ELSE (
IF NOT EXIST "%dest%%~2_(%dupCnt%)%~3" ECHO F | XCOPY /Y /F "%~1" "%dest%%~2_(%dupCnt%)%~3" && DEL /Q /F "%~1"
SET "dupCnt=1"
)
GOTO :EOF
Results
Note: If you wish for the duplicate file names to use another naming convention than the
_(#)
I used then you will need to
change the_(%dupCnt%)
in the script within
"%dest%%~2_(%dupCnt%)%~3"
to be whatever other format you wish to
use but%dupCnt%
is the number that will increment. I'm happy to help further with this too.
Source Before
D:Folder_Source
│ file1.txt
│ file2.txt
│ file4.txt
│ file8.txt
│ file99.txt
│
├───FolderA
│ file1.txt
│ file2.txt
│ file4.txt
│ file8.txt
│ file99.txt
│
└───FolderB
file1.txt
file2.txt
file4.txt
file8.txt
file99.txt
Destination After
C:Destination
file1.txt
file1_(1).txt
file1_(2).txt
file2.txt
file2_(1).txt
file2_(2).txt
file8.txt
file8_(1).txt
file8_(2).txt
Source After
D:Folder_Source
│ file4.txt
│ file99.txt
│
├───FolderA
│ file4.txt
│ file99.txt
│
└───FolderB
file4.txt
file99.txt
Further Resources
- FOR /R
- IF
- XCOPY
- DEL
CALL
Batch Substitutions (FOR /?)
In addition, substitution of FOR variable references has been
enhanced. You can now use the following optional syntax:
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
SET
Arithmetic expressions (SET /a)
Placing expressions in "quotes" is optional for simple arithmetic but
required for any expression using logical operators.
Any
SET /A
calculation that returns a fractional result will be
rounded down to the nearest whole integer.
The expression to be evaluated can include the following operators:
+ Add set /a "_num=_num+5"
@LutfiCreativesys I used a combination ofXCOPY
&DEL
rather thanMOVE
since I could put some validation conditional logic in with that command too. Also note that when you move, files will retain NTFS ACL attributes whereas when you useXCOPY
it inherits the ACL attributes from the location which the files are copied. Typically you want to handle file security at a folder level so that is another reason I preferXCOPY
overMOVE
although I usedRobocopy
a lot too, I usually don't keep dupes like this though either. Let me know if I can adjust further to accommodate your needs.
– Pimp Juice IT
Jan 23 at 22:11
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1395953%2fmove-multiple-files-from-subfolders-to-one-folder-using-cmd-or-batch%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use a batch script and set three variables in it with one being the path to the root source directory which will be traversed for specific files, the second being the destination path where the new files will be copied, and the third being a file list of the file names you wish to copy to the destination directory.
With these three variables you can use a FOR /R
loop to traverse the source location and use conditional IF
logic to check whether or not files already exist for whatever copy or delete operation needs to be performed with each file. Furthermore you can use a CALL
and variable substitutions to pass the parts of the file name to another routine and use additional IF
logic along with SET /A
to increment the duplicate file number, etc.
Batch Script
@ECHO OFF
SET "source=C:Folder_Source"
SET "dest=C:Destination"
SET "FileList=file1.txt file2.txt file8.txt"
SET "dupCnt=1"
FOR /R "%source%" %%A IN (%FileList%) DO (
IF NOT EXIST "%dest%%%~NXA" (
XCOPY /F /Y "%%~FA" "%dest%" && IF EXIST "%%~FA" DEL /Q /F "%%~FA"
) ELSE (
CALL :DupeRoutine "%%~FA" "%%~NA" "%%~XA"
)
)
GOTO :EOF
:DupeRoutine
IF EXIST "%dest%%~2_(%dupCnt%)%~3" (
SET /A dupCnt=%dupCnt%+1
CALL :DupeRoutine "%~1" "%~2" "%~3"
) ELSE (
IF NOT EXIST "%dest%%~2_(%dupCnt%)%~3" ECHO F | XCOPY /Y /F "%~1" "%dest%%~2_(%dupCnt%)%~3" && DEL /Q /F "%~1"
SET "dupCnt=1"
)
GOTO :EOF
Results
Note: If you wish for the duplicate file names to use another naming convention than the
_(#)
I used then you will need to
change the_(%dupCnt%)
in the script within
"%dest%%~2_(%dupCnt%)%~3"
to be whatever other format you wish to
use but%dupCnt%
is the number that will increment. I'm happy to help further with this too.
Source Before
D:Folder_Source
│ file1.txt
│ file2.txt
│ file4.txt
│ file8.txt
│ file99.txt
│
├───FolderA
│ file1.txt
│ file2.txt
│ file4.txt
│ file8.txt
│ file99.txt
│
└───FolderB
file1.txt
file2.txt
file4.txt
file8.txt
file99.txt
Destination After
C:Destination
file1.txt
file1_(1).txt
file1_(2).txt
file2.txt
file2_(1).txt
file2_(2).txt
file8.txt
file8_(1).txt
file8_(2).txt
Source After
D:Folder_Source
│ file4.txt
│ file99.txt
│
├───FolderA
│ file4.txt
│ file99.txt
│
└───FolderB
file4.txt
file99.txt
Further Resources
- FOR /R
- IF
- XCOPY
- DEL
CALL
Batch Substitutions (FOR /?)
In addition, substitution of FOR variable references has been
enhanced. You can now use the following optional syntax:
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
SET
Arithmetic expressions (SET /a)
Placing expressions in "quotes" is optional for simple arithmetic but
required for any expression using logical operators.
Any
SET /A
calculation that returns a fractional result will be
rounded down to the nearest whole integer.
The expression to be evaluated can include the following operators:
+ Add set /a "_num=_num+5"
@LutfiCreativesys I used a combination ofXCOPY
&DEL
rather thanMOVE
since I could put some validation conditional logic in with that command too. Also note that when you move, files will retain NTFS ACL attributes whereas when you useXCOPY
it inherits the ACL attributes from the location which the files are copied. Typically you want to handle file security at a folder level so that is another reason I preferXCOPY
overMOVE
although I usedRobocopy
a lot too, I usually don't keep dupes like this though either. Let me know if I can adjust further to accommodate your needs.
– Pimp Juice IT
Jan 23 at 22:11
add a comment |
You can use a batch script and set three variables in it with one being the path to the root source directory which will be traversed for specific files, the second being the destination path where the new files will be copied, and the third being a file list of the file names you wish to copy to the destination directory.
With these three variables you can use a FOR /R
loop to traverse the source location and use conditional IF
logic to check whether or not files already exist for whatever copy or delete operation needs to be performed with each file. Furthermore you can use a CALL
and variable substitutions to pass the parts of the file name to another routine and use additional IF
logic along with SET /A
to increment the duplicate file number, etc.
Batch Script
@ECHO OFF
SET "source=C:Folder_Source"
SET "dest=C:Destination"
SET "FileList=file1.txt file2.txt file8.txt"
SET "dupCnt=1"
FOR /R "%source%" %%A IN (%FileList%) DO (
IF NOT EXIST "%dest%%%~NXA" (
XCOPY /F /Y "%%~FA" "%dest%" && IF EXIST "%%~FA" DEL /Q /F "%%~FA"
) ELSE (
CALL :DupeRoutine "%%~FA" "%%~NA" "%%~XA"
)
)
GOTO :EOF
:DupeRoutine
IF EXIST "%dest%%~2_(%dupCnt%)%~3" (
SET /A dupCnt=%dupCnt%+1
CALL :DupeRoutine "%~1" "%~2" "%~3"
) ELSE (
IF NOT EXIST "%dest%%~2_(%dupCnt%)%~3" ECHO F | XCOPY /Y /F "%~1" "%dest%%~2_(%dupCnt%)%~3" && DEL /Q /F "%~1"
SET "dupCnt=1"
)
GOTO :EOF
Results
Note: If you wish for the duplicate file names to use another naming convention than the
_(#)
I used then you will need to
change the_(%dupCnt%)
in the script within
"%dest%%~2_(%dupCnt%)%~3"
to be whatever other format you wish to
use but%dupCnt%
is the number that will increment. I'm happy to help further with this too.
Source Before
D:Folder_Source
│ file1.txt
│ file2.txt
│ file4.txt
│ file8.txt
│ file99.txt
│
├───FolderA
│ file1.txt
│ file2.txt
│ file4.txt
│ file8.txt
│ file99.txt
│
└───FolderB
file1.txt
file2.txt
file4.txt
file8.txt
file99.txt
Destination After
C:Destination
file1.txt
file1_(1).txt
file1_(2).txt
file2.txt
file2_(1).txt
file2_(2).txt
file8.txt
file8_(1).txt
file8_(2).txt
Source After
D:Folder_Source
│ file4.txt
│ file99.txt
│
├───FolderA
│ file4.txt
│ file99.txt
│
└───FolderB
file4.txt
file99.txt
Further Resources
- FOR /R
- IF
- XCOPY
- DEL
CALL
Batch Substitutions (FOR /?)
In addition, substitution of FOR variable references has been
enhanced. You can now use the following optional syntax:
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
SET
Arithmetic expressions (SET /a)
Placing expressions in "quotes" is optional for simple arithmetic but
required for any expression using logical operators.
Any
SET /A
calculation that returns a fractional result will be
rounded down to the nearest whole integer.
The expression to be evaluated can include the following operators:
+ Add set /a "_num=_num+5"
@LutfiCreativesys I used a combination ofXCOPY
&DEL
rather thanMOVE
since I could put some validation conditional logic in with that command too. Also note that when you move, files will retain NTFS ACL attributes whereas when you useXCOPY
it inherits the ACL attributes from the location which the files are copied. Typically you want to handle file security at a folder level so that is another reason I preferXCOPY
overMOVE
although I usedRobocopy
a lot too, I usually don't keep dupes like this though either. Let me know if I can adjust further to accommodate your needs.
– Pimp Juice IT
Jan 23 at 22:11
add a comment |
You can use a batch script and set three variables in it with one being the path to the root source directory which will be traversed for specific files, the second being the destination path where the new files will be copied, and the third being a file list of the file names you wish to copy to the destination directory.
With these three variables you can use a FOR /R
loop to traverse the source location and use conditional IF
logic to check whether or not files already exist for whatever copy or delete operation needs to be performed with each file. Furthermore you can use a CALL
and variable substitutions to pass the parts of the file name to another routine and use additional IF
logic along with SET /A
to increment the duplicate file number, etc.
Batch Script
@ECHO OFF
SET "source=C:Folder_Source"
SET "dest=C:Destination"
SET "FileList=file1.txt file2.txt file8.txt"
SET "dupCnt=1"
FOR /R "%source%" %%A IN (%FileList%) DO (
IF NOT EXIST "%dest%%%~NXA" (
XCOPY /F /Y "%%~FA" "%dest%" && IF EXIST "%%~FA" DEL /Q /F "%%~FA"
) ELSE (
CALL :DupeRoutine "%%~FA" "%%~NA" "%%~XA"
)
)
GOTO :EOF
:DupeRoutine
IF EXIST "%dest%%~2_(%dupCnt%)%~3" (
SET /A dupCnt=%dupCnt%+1
CALL :DupeRoutine "%~1" "%~2" "%~3"
) ELSE (
IF NOT EXIST "%dest%%~2_(%dupCnt%)%~3" ECHO F | XCOPY /Y /F "%~1" "%dest%%~2_(%dupCnt%)%~3" && DEL /Q /F "%~1"
SET "dupCnt=1"
)
GOTO :EOF
Results
Note: If you wish for the duplicate file names to use another naming convention than the
_(#)
I used then you will need to
change the_(%dupCnt%)
in the script within
"%dest%%~2_(%dupCnt%)%~3"
to be whatever other format you wish to
use but%dupCnt%
is the number that will increment. I'm happy to help further with this too.
Source Before
D:Folder_Source
│ file1.txt
│ file2.txt
│ file4.txt
│ file8.txt
│ file99.txt
│
├───FolderA
│ file1.txt
│ file2.txt
│ file4.txt
│ file8.txt
│ file99.txt
│
└───FolderB
file1.txt
file2.txt
file4.txt
file8.txt
file99.txt
Destination After
C:Destination
file1.txt
file1_(1).txt
file1_(2).txt
file2.txt
file2_(1).txt
file2_(2).txt
file8.txt
file8_(1).txt
file8_(2).txt
Source After
D:Folder_Source
│ file4.txt
│ file99.txt
│
├───FolderA
│ file4.txt
│ file99.txt
│
└───FolderB
file4.txt
file99.txt
Further Resources
- FOR /R
- IF
- XCOPY
- DEL
CALL
Batch Substitutions (FOR /?)
In addition, substitution of FOR variable references has been
enhanced. You can now use the following optional syntax:
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
SET
Arithmetic expressions (SET /a)
Placing expressions in "quotes" is optional for simple arithmetic but
required for any expression using logical operators.
Any
SET /A
calculation that returns a fractional result will be
rounded down to the nearest whole integer.
The expression to be evaluated can include the following operators:
+ Add set /a "_num=_num+5"
You can use a batch script and set three variables in it with one being the path to the root source directory which will be traversed for specific files, the second being the destination path where the new files will be copied, and the third being a file list of the file names you wish to copy to the destination directory.
With these three variables you can use a FOR /R
loop to traverse the source location and use conditional IF
logic to check whether or not files already exist for whatever copy or delete operation needs to be performed with each file. Furthermore you can use a CALL
and variable substitutions to pass the parts of the file name to another routine and use additional IF
logic along with SET /A
to increment the duplicate file number, etc.
Batch Script
@ECHO OFF
SET "source=C:Folder_Source"
SET "dest=C:Destination"
SET "FileList=file1.txt file2.txt file8.txt"
SET "dupCnt=1"
FOR /R "%source%" %%A IN (%FileList%) DO (
IF NOT EXIST "%dest%%%~NXA" (
XCOPY /F /Y "%%~FA" "%dest%" && IF EXIST "%%~FA" DEL /Q /F "%%~FA"
) ELSE (
CALL :DupeRoutine "%%~FA" "%%~NA" "%%~XA"
)
)
GOTO :EOF
:DupeRoutine
IF EXIST "%dest%%~2_(%dupCnt%)%~3" (
SET /A dupCnt=%dupCnt%+1
CALL :DupeRoutine "%~1" "%~2" "%~3"
) ELSE (
IF NOT EXIST "%dest%%~2_(%dupCnt%)%~3" ECHO F | XCOPY /Y /F "%~1" "%dest%%~2_(%dupCnt%)%~3" && DEL /Q /F "%~1"
SET "dupCnt=1"
)
GOTO :EOF
Results
Note: If you wish for the duplicate file names to use another naming convention than the
_(#)
I used then you will need to
change the_(%dupCnt%)
in the script within
"%dest%%~2_(%dupCnt%)%~3"
to be whatever other format you wish to
use but%dupCnt%
is the number that will increment. I'm happy to help further with this too.
Source Before
D:Folder_Source
│ file1.txt
│ file2.txt
│ file4.txt
│ file8.txt
│ file99.txt
│
├───FolderA
│ file1.txt
│ file2.txt
│ file4.txt
│ file8.txt
│ file99.txt
│
└───FolderB
file1.txt
file2.txt
file4.txt
file8.txt
file99.txt
Destination After
C:Destination
file1.txt
file1_(1).txt
file1_(2).txt
file2.txt
file2_(1).txt
file2_(2).txt
file8.txt
file8_(1).txt
file8_(2).txt
Source After
D:Folder_Source
│ file4.txt
│ file99.txt
│
├───FolderA
│ file4.txt
│ file99.txt
│
└───FolderB
file4.txt
file99.txt
Further Resources
- FOR /R
- IF
- XCOPY
- DEL
CALL
Batch Substitutions (FOR /?)
In addition, substitution of FOR variable references has been
enhanced. You can now use the following optional syntax:
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
SET
Arithmetic expressions (SET /a)
Placing expressions in "quotes" is optional for simple arithmetic but
required for any expression using logical operators.
Any
SET /A
calculation that returns a fractional result will be
rounded down to the nearest whole integer.
The expression to be evaluated can include the following operators:
+ Add set /a "_num=_num+5"
edited Jan 23 at 22:03
answered Jan 23 at 21:41
Pimp Juice ITPimp Juice IT
24.1k113973
24.1k113973
@LutfiCreativesys I used a combination ofXCOPY
&DEL
rather thanMOVE
since I could put some validation conditional logic in with that command too. Also note that when you move, files will retain NTFS ACL attributes whereas when you useXCOPY
it inherits the ACL attributes from the location which the files are copied. Typically you want to handle file security at a folder level so that is another reason I preferXCOPY
overMOVE
although I usedRobocopy
a lot too, I usually don't keep dupes like this though either. Let me know if I can adjust further to accommodate your needs.
– Pimp Juice IT
Jan 23 at 22:11
add a comment |
@LutfiCreativesys I used a combination ofXCOPY
&DEL
rather thanMOVE
since I could put some validation conditional logic in with that command too. Also note that when you move, files will retain NTFS ACL attributes whereas when you useXCOPY
it inherits the ACL attributes from the location which the files are copied. Typically you want to handle file security at a folder level so that is another reason I preferXCOPY
overMOVE
although I usedRobocopy
a lot too, I usually don't keep dupes like this though either. Let me know if I can adjust further to accommodate your needs.
– Pimp Juice IT
Jan 23 at 22:11
@LutfiCreativesys I used a combination of
XCOPY
& DEL
rather than MOVE
since I could put some validation conditional logic in with that command too. Also note that when you move, files will retain NTFS ACL attributes whereas when you use XCOPY
it inherits the ACL attributes from the location which the files are copied. Typically you want to handle file security at a folder level so that is another reason I prefer XCOPY
over MOVE
although I used Robocopy
a lot too, I usually don't keep dupes like this though either. Let me know if I can adjust further to accommodate your needs.– Pimp Juice IT
Jan 23 at 22:11
@LutfiCreativesys I used a combination of
XCOPY
& DEL
rather than MOVE
since I could put some validation conditional logic in with that command too. Also note that when you move, files will retain NTFS ACL attributes whereas when you use XCOPY
it inherits the ACL attributes from the location which the files are copied. Typically you want to handle file security at a folder level so that is another reason I prefer XCOPY
over MOVE
although I used Robocopy
a lot too, I usually don't keep dupes like this though either. Let me know if I can adjust further to accommodate your needs.– Pimp Juice IT
Jan 23 at 22:11
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1395953%2fmove-multiple-files-from-subfolders-to-one-folder-using-cmd-or-batch%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown