batch files are generally pretty simple-minded things, not at all as powerful as *nix shell scripts. For more complicated tasks you would be better off writing a program in some other language, such as C or C++.
yes there is that option, but the way I understand it is that he only wants to delete selected files/folders, not all of them. Use "rd /s" command to remove all the files and directories in the current tree. warning: do not do this from root directory such as c:\
I am trying to write a batch file which would recursively delete folders with a specific name inside a tree. i am just not able to do that. Please help me.
thanks for your help in advance
This will do the trick:
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q %%G
If you're thinking WTF?:
DIR /B /AD /S *.svn*
lists all files that are named ".svn"
/B makes the output "bare" with nothing but the file name
/AD only lists directories
/S recurses subdirectories to include their contents if they match the listing criteria
RMDIR /S /Q [path/name]
deletes the directory [path/dir] and all of it's children
FOR /F processes each item (in this case directories) in the set IN ('[command]') by executing the DO [command]
%%G is a parameter, which in this example is a directory name
"tokens=*" says that all the characters output in a line (i.e. by the dir command) are assigned to the parameter %%G
Thanks for the script, it works great! Some of my directories would not delete due to having spaces in the directory names, for instance C:\out\IQSv3\Portal\Web References\Service\.svn. Adding quotes around the %%G fixed this problem.
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q "%%G"
I haven't tried batch file but if you want to do this just once you can use normal windows search. Just search .svn and check option search hidden files in advanced options. Then just delete all .SVn's from search results.
hi i am new this forum, unable to find where to post my question.
i need a batch file ,should delete oldfiles except last 15 days, means i should retain only last 15 days folder. the folder name is based on date,ex- today folder will be 20070428.pl help.thanks in advane.
Doggfather - Im getting the same error - when applying single quotes from command line. Does anyone know what Im doing wrong...
No matter what I do i get:
%%G was unexpected at this time.
Yes I know exactly what your doing wrong. This will not work if entered directly at the command prompt because the double % syntax is only for running the command from a batch file. From the command line you only need a single %G for it to work properly. Hope that help somebody out there who was looking for the answer to this one.
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: