Timeline for Find latest folder/file version and remove - no time stamp data
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 4, 2018 at 3:37 | history | edited | G-Man Says 'Reinstate Monica' | CC BY-SA 3.0 |
Gotta catch ’em all!
|
| Feb 4, 2018 at 3:06 | vote | accept | wade812 | ||
| Feb 3, 2018 at 23:43 | history | edited | Chris Davies | CC BY-SA 3.0 |
Improvements from suggestions by G-Man
|
| Feb 3, 2018 at 23:37 | comment | added | Chris Davies | @G-Man all the examples dictated files with an extension. Those are what I have matched. I think I've fixed the remainder of your suggestions (at least one slipped through my rewrite of prototype code). Thanks | |
| Feb 3, 2018 at 20:46 | comment | added | wade812 | -- G-Man -- I updated the question to make it clear what are folders and what are files. Yes 'EF' was a folder but I changed it to 'FolderX' to make it more clear. Again don't have to worry about Folder finding and renaming as I have already taken care of that. Just concerned with files. Thank you for following up with me. Appreciate it! Still need to understand how to call 'roaima' code from a contruct. :-) | |
| Feb 3, 2018 at 19:56 | comment | added | G-Man Says 'Reinstate Monica' |
(Cont’d) … (3) This will mv 62bf7ca1_002.doc 62bf7ca1.doc without first doing rm 62bf7ca1.doc. This will cause problems if 62bf7ca1.doc is read-only. (I would suggest initializing versions=("$file"), so the unnumbered version gets deleted if there are other versions. Doing mv -f is another option.) (4) You should probably use -- with rm and mv to protect against filenames beginning with -.
|
|
| Feb 3, 2018 at 19:56 | comment | added | G-Man Says 'Reinstate Monica' |
(1) *.* expands to a list of filenames that contain .. The question mentions Archive, Documents, and EF. Yes, the first two are probably directories, but I don’t know what EF is, and *.* will ignore it. (Of course, by definition, filenames with no . have no extension, so you would need slightly different code to handle them.) (2) You could use globstar to search a directory tree. … (Cont’d)
|
|
| Feb 3, 2018 at 19:15 | comment | added | wade812 | Thank you for the response Roaima. I ran the for loop and it produced the output I am looking for. Appreciate it. Sorry I have to ask but how would I put this into a script and call the script from a find -type d -exec construct? like this? #!/bin/bash find -type -d -exec myscript {} \; | |
| Feb 3, 2018 at 13:58 | history | answered | Chris Davies | CC BY-SA 3.0 |