| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 143056 | 2016-11-10 00:50:00 | How to automatically organise a whole bunch of files | Tony (4941) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 1428618 | 2016-11-14 02:06:00 | Open a Search window on the uppermost folder in the chain. Search for *.* (all files). Select All Copy Paste into target folder. Manage filename collisions if they occur during the paste.Really good idea - unfortunately it doesn't appear to work as expected. I actually can't quite work out what occurred.The original folder had 31 folders (some with subfolders, some just with files) + a couple of odd files. When I did the search it said there were 1469 items consisting of folders and files. I did the select all then copied and pasted them into a new top-level folder, totally separate from the original folder structure. That folder had a collection of files and folders totalling 782 items. What it looks like has happened is that it has pasted all the original folders with their contents at the top level, and posted the files that were in the folders separately at the top level. There is no way I'm going to try and analyse it further! So thanks Paul, I really thought that might work - but no. What it did do though was to highlight a possibly insurmountable problem even if I find another process that works - there were a whole lot of files that had duplicate names, but different sizes and dates that all got pasted at that new top level. They had names like "page 2 Feb.pdf" - but which year??? Even if I opened each individual file it is not necessarily going to be clear what the year is. I can make some inferences from the file date, but it would actually be even more time consuming than going through the original file structure. I think what I am going to have to do is actually traverse a copied version of the entire original file structure, creating the archival documents and putting them into a new file structure then deleting the originals as I go. At various (possibly many) points I will find I have duplication and at that point I will have to decide whether it is in fact a genuine duplicate, or an intermediate version of the same newsletter and then decide which to keep. I do have printed versions of them all so I can compare the PDF with the paper version. In fact as I type it makes me think it might actually be quicker to just scan everything rather than just the early copies that have no existing PDF versions. The downside of that is that the scans will be greyscale like the paper, whereas the PDFs are in glorious RGB. Fortunately there is no rush for this to be completed so I'll check back in a year or so and report progress. :) |
Tony (4941) | ||
| 1428619 | 2016-11-14 03:03:00 | Powershell: $source = "c:\source\folder" $dest = "c:\dest\folder" $fileList = gci $source -File -Recurse foreach ($file in $fileList) { Move-Item $file.fullname $dest -Force } Note if you have duplicate file names in the source structure this will not automatically rename, it will overwrite in move |
inphinity (7274) | ||
| 1428620 | 2016-11-14 03:52:00 | Powershell: $source = "c:\source\folder" $dest = "c:\dest\folder" $fileList = gci $source -File -Recurse foreach ($file in $fileList) { Move-Item $file.fullname $dest -Force } Note if you have duplicate file names in the source structure this will not automatically rename, it will overwrite in move Thanks for that. I'd suspected it could be done with Powershell, but I've never used it. The automatic overwrite would be an issue though, and I'd still have the problem of identifying what year "Page 1 feb.pdf" referred to when they were all side by side at the same level. |
Tony (4941) | ||
| 1428621 | 2016-11-14 09:54:00 | Do you use PowerShell or any other language? Scripting it, is by far the better choice. Looking at that code by inphinity to not overwrite same named files is that before you move the file, you check if it exists first, and if it does, give yourself some choices as to what to do, like renaming it. You could even fix the date issue. One method, I will call it flattening, where every file gets the name of the directory added in front. So a file called, '2 feb.pdf' inside a folder called '2004', the moved file becomes '2004 2 feb.pdf' in the new location. Another method is we detect dates in the filename and append the directory to it. Could use this method for same named files too. I have never used powershell, but it seems to mimic other scripting languages, so it maybe able to do the trick. |
Kame (312) | ||
| 1428622 | 2016-11-14 18:22:00 | Do you use PowerShell or any other language?I've never used Powershell but I do have programming/scripting skills, so I might give it a look. It is going to be a trade-off between the time spent getting up to speed with Powershell and the time to actually do the work. It could be an interesting exercise though. One of these days I'll learn the lesson to never volunteer for anything. :) |
Tony (4941) | ||
| 1 2 | |||||