User Tools

Site Tools


bash

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
bash [2023/10/01 17:28] – getopts rjtbash [2025/04/23 12:45] (current) – Copy files from list to single directory rjt
Line 48: Line 48:
  mv -- "$file" "$(mktemp --dry-run XXXXXXXX.jpeg)"  mv -- "$file" "$(mktemp --dry-run XXXXXXXX.jpeg)"
 done done
 +</code>
 +
 +==== Move all files in subdirectories to parent ====
 +
 +  * https://unix.stackexchange.com/questions/358284/move-all-files-inside-sub-folders-to-parent-folder
 +
 +<code bash>
 +find . -mindepth 2 -type f -print -exec mv {} . \;
 +</code>
 +
 +==== Copy files from list to single directory ====
 +
 +Takes paths in a text file (one per line), and copies the files they point to to a single location. I use this to put audio files from playlists into directories I can move over to my phone.
 +
 +<code bash>
 +while IFS= read -r filename; do cp "$filename" [output directory]; done < [source list]
 </code> </code>
  
bash.1696141718.txt.gz · Last modified: 2023/10/01 17:28 by rjt