Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.

Finding files older than x days within directory with spaces

Login or Register to Reply

Thread Tools Search this Thread
# 1  
Finding files older than x days within directory with spaces


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.

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

When running the above the usual error message is thrown back

+ 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

/target\ directory/

and also putting into quotes

/"target directory"/

But still find issues.

Any help is much appreciated.
# 2  
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:-
find /files/target\ directory -type f -mtime +60

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

I hope that this helps,
Login or Register to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
List and Delete Files which are older than 7 days, but have white spaces in file name
I need to list and delete all files in current older which are olderthan 7 days. But my file names have white spaces. Before deleting I want to list all the files, so that I can verify.find . -type f -mtime +7 | xargs ls -l {} But the ls command is the working on the files which have white...... Shell Programming and Scripting
Shell Programming and Scripting
Want to delete directory, subdirectories and all files which are older than 7 days
how do i remove sub directories of a directory and all files which are older than 7 days by a single command in AIX. pls help me. I am using command as #find /gpfs1/home/vinod/hpc/ -depth -type d -mtime +7 -exec rm -rf {} \; so i want to delete all sub directories and all files from the...... AIX
Delete files older than 10 Days in a directory
Hi All I want to remove the files with name like data*.csv from the directory older than 10 days. If there is no files exists to remove older than 10 days, It should not do anything. Thanks Jo... Shell Programming and Scripting
Shell Programming and Scripting
Deleting / finding files older than X days missess a day
Hi When trying to find and delete files which are, say, 1 day, the find command misses a day. Please refer the following example. xxxd$ find . -type f -ctime +1 -exec ls -ltr {} \; total 64 -rw-rw-r-- 1 oracle xxxd 81 Apr 30 11:25 ./ful_cfg_tmp_20080429_7.dat -rw-rw-r-- 1...... Shell Programming and Scripting
Shell Programming and Scripting
Finding cumulative size of files older than certain days
Hi All, I've got a ton of files in a particular directory. I want to find pdf files older than 30 days in that directory and then the cumulative size of those files. Ex: find /home/jk/a -name "*.pdf" -mtime +30 consider it finds the below 4 files. /home/jk/a/1.pdf /home/jk/a/2.pdf...... Shell Programming and Scripting
Shell Programming and Scripting

Featured Tech Videos