Square brackets in filenames

Dec 11, 2012
1
0
Hi,
I've tried to search the help and forum but have not found the (obviously simple) solution to handle filenames with square brackets. Like in

ren "PictureA [1200x900].jpg" "Pict001 [1200x900].jpg"
ren "PictureB [1200x900].jpg" "Pict002 [1200x900].jpg"
... and so on.
Error message is "There are no more files"

Tried setdos /x-7, as suggested in another post, but no help.

/Thomas
 
Aug 2, 2011
258
4
Berlin, Germany
Hi,
here the processing of files with "[" is working.
I've seen these error messages before if I do fileoperations with /S and there are empty subdirectories.
Code:
C:\Temp\sqbr >alias dh=dir  /a:-d /o:-d /p /[d-0]
 
C:\Temp\sqbr >setdos /x0
 
C:\Temp\sqbr >echo. > test[file]01.dat
 
C:\Temp\sqbr >dh
 
Volume in drive C is OSDISK        Serial number is a444:6ef4
Directory of  C:\Temp\sqbr\*
 
12/11/2012  15:04              2  test[file]01.dat
                2 bytes in 1 file and 0 dirs    4,096 bytes allocated
  386,507,780,096 bytes free
 
C:\Temp\sqbr >ren test[file]01.dat test_file_01.*
C:\Temp\sqbr\test[file]01.dat -> C:\Temp\sqbr\test_file_01.dat
    1 file renamed
 
C:\Temp\sqbr >dh
 
Volume in drive C is OSDISK        Serial number is a444:6ef4
Directory of  C:\Temp\sqbr\*
 
12/11/2012  15:04              2  test_file_01.dat
                2 bytes in 1 file and 0 dirs    4,096 bytes allocated
  386,507,780,096 bytes free
 
C:\Temp\sqbr >echo. > "PictureA [1200x900].jpg"
 
C:\Temp\sqbr >dh
 
Volume in drive C is OSDISK        Serial number is a444:6ef4
Directory of  C:\Temp\sqbr\*
 
12/11/2012  15:04              2  PictureA [1200x900].jpg
12/11/2012  15:04              2  test_file_01.dat
                4 bytes in 2 files and 0 dirs    8,192 bytes allocated
  386,507,780,096 bytes free
 
C:\Temp\sqbr >ren "PictureA [1200x900].jpg" "Pict001 [1200x900].jpg"
C:\Temp\sqbr\PictureA [1200x900].jpg -> C:\Temp\sqbr\Pict001 [1200x900].jpg
    1 file renamed
 
C:\Temp\sqbr >dh
 
Volume in drive C is OSDISK        Serial number is a444:6ef4
Directory of  C:\Temp\sqbr\*
 
12/11/2012  15:04              2  Pict001 [1200x900].jpg
12/11/2012  15:04              2  test_file_01.dat
                4 bytes in 2 files and 0 dirs    8,192 bytes allocated
  386,507,780,096 bytes free
 
Similar threads
Thread starter Title Forum Replies Date
S INPUT fails if the entered text contains pair of square brackets Support 6
B Bdebugger displays an error when typing right square bracket Support 2
A WAD Output redirection to IF block fails with "unbalanced brackets" Support 7
A How to? Work with Filenames Containing Brackets "[" and "]" Support 2
Jay Sage Brackets Around Variable Names Support 11
Phileosophos PDIR to list filenames without extensions? Support 2
D How to? Filenames with "&" character Support 3
fpefpe How to? processing filenames Support 6
C Filenames with ";" Support 13
E Fixed DEDUPE doesn't handle filenames with whitespace properly when symlinking Support 1
mikea How to? Problem with @SFN (short filenames) Support 6
A CDD and DOS filenames Support 1
C How to? Replace &'s in filenames / FixNames.dll Support 2
BobK How to? Handling filenames with blanks at command line Support 3
J Fixed Filename completion does not quote filenames containing ^ Support 1
JohnQSmith Filenames with semicolons Support 5
P Support for national letters in filenames in ftp operations Support 1
N Problems with backquotes in filenames Support 17
S Suggestion: enhanced automatic quoting of filenames Support 2
S PDIR has trouble processing filenames with embedded percent sign Support 3
C handling percent signs in filenames Support 2
C handling percent signs in filenames Support 1
B Problems with %-sign in filenames/directory names Support 6
Jay Sage Dealing With Filenames Containing Slash Character Support 5
A Color in filenames in listview Support 1

Similar threads