Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I guess in most cases when extracting a tar achive ,we will get a directory with the same name as the archive file but different suffix. but in some unlucky case, as I met today, after extract a tar bar I find lots of files spread in the working directory, which is really nuisance.

so what I want to learn from you is that how can I move thoes newly created files ? I know it should be some "find plus rm" fancy approch there, but I don't know exactly how.

share|improve this question

3 Answers 3

I wonder what man find would say. Then you can even show your efforts.

find . -type f -cmin -1
find . -type f -cmin -1 -delete
share|improve this answer
Nice! -delete looks easier than -exec rm {} \; –  PJ Brunet Oct 9 '13 at 11:56
find . -mtime -60s -exec mv {} /dest/dir \;

wille find every file in the current directory (and sub directories) that has been modified in the last 60 seconds and move them to /dest/dir

share|improve this answer

The easies way (provided you don't have graphical interface) will be to use mc. It can sort files by date.

You can also delete the files which were in the tar from command line:

> rm $( tar -ztf mytar.tar.gz )

(-ztf) is for tar.gz files. You can use (-tf) for normal tars, or (-jtf) for tar.bz2 files.

If the list of the files is too big, and the above command chokes, you can use xargs:

> tar -ztf mytar.tar.gz | xargs rm
share|improve this answer
wow, my bad - I did not read the question really - you need to move them, not delete (pls, fix the title, its misleading). I guess you still can delete them, then create a new dir, and untar there :). After all, move = copy + delete. –  Sunny Mar 4 '10 at 17:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.