P. Riot
P. Riot

Reputation: 11

cmd returns "cannot find the path specified" for only some files in a folder

I'm trying to write a batch file to rename all files in a series of folders.

Each line has the format [path]"old file name" "new file name"

For some files it works fine, but on other files in the same folder it returns "the system cannot find the path specified," even though the path is exactly the same.

Edit: for example, one line in the batch file is

ren U:\JohnSmith\Portfolio\"08805_09282010_094346_10452467.PDF" "3rd Quarter Report"

and it throws the error, while another line

ren U:\JohnSmith\Portfolio\"08805_03082011_101040_17279080.PDF" "4th Quarter Report"

renamed the file fine, even though the paths are identical.

Upvotes: 0

Views: 2416

Answers (1)

P. Riot
P. Riot

Reputation: 11

I resolved the issue, some of the destination file names had a "/" in their name, I thought putting the new file name in quotes would make it accept it, but once I changed all the slashes to dashes all of the files were renamed.

So

ren "U:\JohnSmith\8804_3598_3987" "11/12 3rd Quarter"

Threw the "system could not find the path" error, but

ren "U:\JohnSmith\8804_3598_3987" "11-12 3rd Quarter"

did not.

Upvotes: 1

Related Questions