tsumaranaina
tsumaranaina

Reputation: 183

Moving files from one subdirectory to another II

My directory is like this:

/Users/dave/Desktop/test/untitled_folder_0001/vol_0000
/Users/dave/Desktop/test/untitled_folder_0001/rs

/Users/dave/Desktop/test/untitled_folder_0001/t1
/Users/dave/Desktop/test/untitled_folder_0001/str

I want to move all vol_0000 to rs and t1 to str in 1500~ untitled_folder_**** inside test in a shell script if possible.

I already tried many times, but got no where. im writing this anew because i was not able to get help before. Here is the previous thread! If this was answered i will delete that one for redundancy.

Moving files from one subdirectory to another

Upvotes: 0

Views: 139

Answers (1)

Mark Reed
Mark Reed

Reputation: 95242

Easiest way is probably with a loop.

for f in /Users/dave/Desktop/test/untitled_folder_*; do
  mv "$f"/vol_0000 "$f"/rs # move everything from `vol_0000` into `rs`
  mv "$f"/t1 "$f"/str
done

... assuming I've understood the goal correctly.

Upvotes: 2

Related Questions