We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide
How to Delete A big folder but with file exceptions?
landghove
Posts: 26 Forumite
in Techie Stuff
Every month I have a folder with many thousands of files. I need to delete all files with the exception of several hundred.
Its the same several hundred every month.
I have no IT skills, this is windows.
Is there an app or something I can just paste the 'keep files' names into then delete the rest?
0
Comments
-
Why not simply move the files you want to keep to a separate folder?2
-
How do you "have" this folder? Does someone send it to you?landghove said:Every month I have a folder with many thousands of files. I need to delete all files with the exception of several hundred.Its the same several hundred every month.I have no IT skills, this is windows.Is there an app or something I can just paste the 'keep files' names into then delete the rest?
Do the names of the ones you want to keep have anything in common? Likewise, the ones you don’t want? Not just the names, perhaps the dates?In short, you’ll not get a good answer until you give more details.No reliance should be placed on the above! Absolutely none, do you hear?1 -
Its a folder on the network...a month end folder...size wise 2.5tb....one file to keep might be named AB_E23, the next F06_3T5....no easy common denominator but the same name list of files each time that can't be deleted.0
-
as above really
if all the files you want to keep begin with 'a' there is a simple solution
if all the file names are random it becomes more difficult
0 -
How are the files getting into the folder?
Any reason the files on the list can't go somewhere else?
Why do they need to be kept if they are going to change again.1 -
If there are thousands to delete, that must take you all month?
How do you know what to keep? Have you memorised the whole list?
Are the keepers older files? You can sort the files in date order in windows. That takes a few seconds. Then the files you want to keep will be at the top of the list.No reliance should be placed on the above! Absolutely none, do you hear?1 -
There are so many ways to approach this but it all depends on what we are dealing with in terms of filenames and types so a bit more info would be useful about what these files are.
How do you get the list if file names you want to keep?
Say for example you just want to keep photos but delete everything else, or maybe you want to delete everything except word documents? Or maybe it is more complicated and there is nothing in common between the files you want to keep so you need to specify the files names for them all? Is it the same file names every month?
Also are all files in one single folder or are we dealing with subfolders?
I'm going to assume the most complicated option but if you give answers to the above question I can probably come up with something else.
1. Save the list of all the filenames you want to keep in a text file called something like keepfiles.txt and save it in the folder with a thousand files. Just use notepad to create it and put one filename on each line. Use the full filenames so you list will look like this:
keepme.txt
important.jpg
needthis.pdf
2. Create a batch file in notepad with the following in it and save it as something like movekeepfiles.bat in the same folder as your thousand files. Replace the underlined file path with the location you want to put the files you want to keep in:for /F "tokens=*" %A in (keepfiles.txt ) do (move %A C:\Users\tallmansix\Documents\Keepfiles\January)
3. Execute the batch file
4. Make a copy of keepfiles.txt and movekeepfiles.txt somewhere safe for you to use them next month.
5. Check everything has moved as expected
5. Delete all the files in the thousand file folder by whatever means you find easiest.
2 -
If this is part of your work, then .... consult your IT dept for a better way.
If it's a business process to be followed, then lean upon those higher up to streamline the process.
1 -
TBH it looks like the whole process from the start needs looking at and sorting out, not just the end bit that the OP is interested in.
Without knowing what these files are, my first impression is that there should be filtering on these thousands of files a lot earlier than in the process to start with.
If the files always have the same name then tallmansix's solution will achieve it.1 -
Great responses all round.Although tallmansix's method answers the question and will work well -provided you make no mistakes with the filenames! -. I too would be looking at the process that results in all those files.As an example (and you really have not told us much about what the activity is and why you end up with so many files that you only want to discard) consider orders or sales records that produce all these files from a database or other software. It is perhaps a dump of records into individual files and you are only interested in a particular set, say those that are from your geographic area. Best polocy is to set up filtering the dump out in the first place.Now that is only a guess as to what thetypes of files data contains, it will probably be something else, but the principle remains. Do the work at source and also benefit from fewer operations on your network.Checking you have created a list of those to retain will fail if you have made an error and that is entirely possible with a list of hundreds and if the files resode on a network location (drive?) then the whole process might fail if IT reconfigure the network.Further consider if you wish to keep the historical files (you imply they all will have the same name) so that this months files are not overwritten by next months files etc i.e. you keep all the files of interest every month.I am just suggesting a wider consideration of what has led up to your question.......2
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 353.6K Banking & Borrowing
- 254.2K Reduce Debt & Boost Income
- 455.1K Spending & Discounts
- 246.7K Work, Benefits & Business
- 603.1K Mortgages, Homes & Bills
- 178.1K Life & Family
- 260.7K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards

