Timeline for Create directory using filenames and move the files to its repective folder
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 29, 2024 at 13:03 | comment | added | Vineeth | Works!! and you just solved my pain of media files management!! | |
| Jun 27, 2014 at 14:55 | comment | added | l0b0 |
I mean it's up to the user (independently of this question) whether to shopt -s nullglob or shopt -s failglob.
|
|
| Jun 27, 2014 at 12:33 | comment | added | gniourf_gniourf | From OP's comment: @gniourf_gniourf: Yes, I copied the same thing and tried. My shell is bash. | |
| Jun 27, 2014 at 12:32 | comment | added | gniourf_gniourf |
So then shopt -s failglob?
|
|
| Jun 27, 2014 at 12:31 | comment | added | l0b0 | That depends on whether there being no matching files is an error or not. | |
| Jun 27, 2014 at 12:30 | comment | added | gniourf_gniourf |
And how about shopt -s nullglob too, to be sure we're on the safe side? :D.
|
|
| Jun 27, 2014 at 12:29 | comment | added | l0b0 |
@gniourf_gniourf errexit to the rescue. For the duplicate suffix, cannot create directory GmZzz3StdPk.txt definitely means that it fails when processing GmZzz3StdPk.txt.txt, independently of the files' sequence in the output.
|
|
| Jun 27, 2014 at 12:28 | history | edited | l0b0 | CC BY-SA 3.0 |
added 31 characters in body
|
| Jun 27, 2014 at 12:26 | comment | added | gniourf_gniourf |
Maybe mkdir -- "$dir" && mv -- "$file" "$dir" to make sure we don't execute uncontrolled commands. Otherwise it's perfect. :D. Not sure though about the something.txt.txt thing; that was my first thought but now I believe that something.txt would come before something.txt.txt in the expansion of *.txt.
|
|
| Jun 27, 2014 at 12:19 | history | answered | l0b0 | CC BY-SA 3.0 |