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
bash [2024/01/10 10:59] – Move all files in subdirectories to parent rjtbash [2025/04/23 12:45] (current) – Copy files from list to single directory rjt
Line 56: Line 56:
 <code bash> <code bash>
 find . -mindepth 2 -type f -print -exec mv {} . \; 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.txt · Last modified: 2025/04/23 12:45 by rjt