Square brackets in filenames

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Dec 11, 2012
1
0
#1
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
 
#2
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