Move Multiple Files From One Directory To Another – Linux

Run this command to show you which files meet the criteria you specified:

# find . -mtime +130 -type f -xdev -ls

Run this command to move the files to a specified folder:

# find . -mtime +130 -type f -xdev -exec mv {} /new/location/ \;

This will show and move files that haven’t changed in atleast 130 days.

The xdev prevents us from searching other filesystems within the selected mountpoint.

 

This command can also be used to delete a certain criteria of files in a folder.

About Abner Udali

Forget computers, let's hack into life and make it what we want it to be!
This entry was posted in Information Technology and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s