Anybody know how to make a script or program that automatically deletes a series of files and folders? Today I have to manually delete each folder and files for a certain program. I want to automate the prosess. It is not more than 10-15 steps. As I am new to programming (except html and css) I need some guidens… Anybody have an idÃ¨?
The ease of automation often depends on how organized the files and folders are in the first place. What kind of organizational structure are you working with? Is everything in one folder? Common filenames? Anything like that?
To add to Craig’s question: how do you identify the files/folders that should be deleted?
Basically the files are in one folder, but some are spread around too. Just would be nice to have it automated, instead I now have to do all this manually. Nice if could just like run a program and then it’s done. But as I’m new to this, I want to learn how to do it. Is it any programs I can use? Or would just bash do?
So you’ve established one target, but the “some are spread around too…” - are they consistently “spread around”. Like, are they always in some other folders? And are they the only files in the folders? If not, what criteria determines if they are ones to be deleted? (Ex. every file in folder “foo” whose creation date is today.)
Remember, with programming, the computer is pretty stupid. You have to EXPLICITLY tell it what you want to happen. You can’t say, “Could you find some files somewhere and delete them for me.” You have to tell it where to look, what to look for, and what you want it to do if it finds the ones you’ve described. That’s not to say the computer has to be hardcoded for every instance (ex. if today’s file is “01202006” and you tell it to delete that file, you don’t want to have to change your code for tomorrow’s file which would be “01212006”). But you have to give it more information than you’re providing here (and the more consistent your parameters, the easier to script).
lnesland it would help if you told us the paths/files .
an easy way to do this is
- open terminal
- find the first file/Folder in finder
- drag that file into the terminal window (notice the path to that file appear)
- copy the text into text edit / or forum reply box.
5 repeat 1-4 with each file
then it will be easier for us to help you.