Linux

RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

Finding files older than x days within directory with spaces

👤 Login to reply

    #1  
Old 04-20-2018
Ads89 Ads89 is offline
Registered User
 
Finding files older than x days within directory with spaces

Hi,

I am trying to run a command that finds all files over x amount of days, issue is one of the directories has spaces within it.

Code:
find /files/target directory/*/* -type f -mtime +60

When running the above the usual error message is thrown back

Code:
+ find '/files/target\' 'directory/*/*' -type f -mtime +60
find: ‚/files/target\\‚: No such file or directory
find: ‚directory/*/*‚: No such file or directory

I have tried backspacing out the space

Code:
/target\ directory/

and also putting into quotes

Code:
/"target directory"/

But still find issues.

Any help is much appreciated.
Sponsored Links
    #2  
Old 04-20-2018
rbatte1 rbatte1 is online now Forum Staff  
Root armed
 
The directory to search by find does not really need the /*/* at the end. It will start where you put it and search down from that point.

Try it like this, escaping the space properly and without any quoting:-
Code:
find /files/target\ directory -type f -mtime +60

An alternate might be with quoting:-
Code:
find '/files/target directory' -type f -mtime +60



I hope that this helps,
Robin
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
List and Delete Files which are older than 7 days, but have white spaces in file name karumudi7 Shell Programming and Scripting 16 04-26-2015 11:09 PM
Want to delete directory, subdirectories and all files which are older than 7 days vinodkmpal AIX 1 10-16-2012 04:41 PM
Delete files older than 10 Days in a directory rajeshjohney Shell Programming and Scripting 9 05-25-2012 09:31 AM
Deleting / finding files older than X days missess a day guruparan18 Shell Programming and Scripting 4 05-08-2008 06:09 AM
Finding cumulative size of files older than certain days rohan076 Shell Programming and Scripting 1 04-28-2008 01:07 PM



All times are GMT -4. The time now is 09:36 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?