Answer the question
In order to leave comments, you need to log in
How to move all files to another folder besides folder using terminal?
I have a lot of videos on the subject of filters in the Videos folder.
To clean things up a little, I created a filters folder in the Videos folder where I want to move all the videos on this topic.
So I can't write:
mv /home/user/Videos/* /home/user/Videos/filters
Because then the filters folder, which is in Videos, will be copied to itself.
Answer the question
In order to leave comments, you need to log in
Well, if you need to transfer only files, but do not touch other directories, then you can try
mv /home/user/Videos/*.* /home/user/Videos/filters
. Since files usually have extensions.
$ cd $HOME/Videos
$ mv !(filters) filters
$ shopt -s extglob
$ shopt
...
extglob on
...
Everything is easier! No need to create problems where there are none.
With the specified command, everything will be transferred as it should, mv will only swear:
mv: невозможно перенести 'videos' в свой собственный подкаталог, 'videos/videos'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question