Hi! I apologise in advance if this is something that I should have been able to work out for myself, but I've got to the point where my imagination has run out of options!
I am trying to move files from a folder named "Photos" and its numerous sub-folders. The common denominator is that the files to move all contain "-2.cr2". I want to move them (not copy) to another folder on the same drive, named "CR2DUpes.". I am using the following:
C:\>move/f e:\photos\/s *-2.cr2 e:\cr2Dupes and I get:"The syntax of the command is incorrect."
I have tried doing a DIR query using similar syntax and that works OK - I have tried re-positioning the "/s" option.
As you will have realised, I am not skilled at this! Can anyone please tell me where I am going wrong?
Many thanks,
Martin
Cmd line instruction to move selected files from sub-folders
Moderator: DosItHelp
Re: Cmd line instruction to move selected files from sub-fol
Move does not have an /S or /F option if you happened to read the help file.
Code: Select all
H:\>move /?
Moves files and renames files and directories.
To move one or more files:
MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination
To rename a directory:
MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2
[drive:][path]filename1 Specifies the location and name of the file
or files you want to move.
destination Specifies the new location of the file. Destination
can consist of a drive letter and colon, a
directory name, or a combination. If you are moving
only one file, you can also include a filename if
you want to rename the file when you move it.
[drive:][path]dirname1 Specifies the directory you want to rename.
dirname2 Specifies the new name of the directory.
/Y Suppresses prompting to confirm you want to
overwrite an existing destination file.
/-Y Causes prompting to confirm you want to overwrite
an existing destination file.
The switch /Y may be present in the COPYCMD environment variable.
This may be overridden with /-Y on the command line. Default is
to prompt on overwrites unless MOVE command is being executed from
within a batch script.
Re: Cmd line instruction to move selected files from sub-fol
This should help - there are caveats in that it also matches in the short filename.
Code: Select all
@echo off
md "e:\cr2Dupes" 2>nul
for /r "e:\photos\" %%a in (*-2.cr2) do (
echo move "%%a" "e:\cr2Dupes"
)
pause
Re: Cmd line instruction to move selected files from sub-fol
Thank you for the prompt answers & help.
I had read the Help file and I was aware of the "Y" in the move - I suffered memory/typing error I'm afraid. I used the /S to find the sub-directories.
However, problem solved. Thanks again.
Martin
I had read the Help file and I was aware of the "Y" in the move - I suffered memory/typing error I'm afraid. I used the /S to find the sub-directories.
However, problem solved. Thanks again.
Martin