Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wildcards and the MOVE command in a batch file - Wildcard not recognised as such

I have a batch file with the following line in it:

move d:\cdr\C0*.%yyyy%-%mm%-%dd%*.csv d:\CDRArchive\%yyyy%%mm%\

where the variables yyyy mm and dd are for their resective parts of a given date. When I run this, the batch file parses the variables out correctly, but I doesn't recognise the wildcard character *, so I get the following line:

> move d:\cdr\archive\C0*.2013-09-08*.csv d:\CDRArchive\201309\
A duplicate file name exists, or the file cannot be found.

Any help is much appreciated.

like image 270
IJBurgess Avatar asked Sep 16 '13 15:09

IJBurgess


People also ask

What is move in batch file?

To batch move files in a folder, we are using the “move” command. As shown here, we are moving all the contents of “Folder A” to “Folder B.” The command is as follows: move Source-Folder-Path*.* Destination-Folder-Path. Here, *.

How do I use the move command in Windows?

Press the keyboard shortcut Command + C . Move to the location you want to move the files and press Option + Command + V to move the files.


1 Answers

It works fine, once the target folder is created. Note that the error message you supplied shows that the filespec is wrong or the folder is wrong. The error message you get when they are right is shown below. (tested in Windows 8)

d:\>move d:\cdr\C0*.2000-10-01*.csv d:\CDRArchive\200010\
Cannot move multiple files to a single file.

d:\>md d:\CDRArchive\200010\

d:\>move d:\cdr\C0*.2000-10-01*.csv d:\CDRArchive\200010\
d:\cdr\C0abc.2000-10-01.aaa.csv
d:\cdr\C0abc.2000-10-01.bbb.csv
d:\cdr\C0abc.2000-10-01.ccc.csv
        3 file(s) moved.
like image 114
foxidrive Avatar answered Oct 03 '22 07:10

foxidrive