Finding files older than x days within directory with spaces

Tags
linux

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 04-20-2018
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.
# 2  
Old 04-20-2018
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
Login to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Similar Threads 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-27-2015 12:09 AM
How to move the files older than x days with similar directory structure? prvnrk Shell Programming and Scripting 3 09-18-2014 02:22 PM
Remove files older than 2 days. Navkreddy Shell Programming and Scripting 2 02-27-2013 10:49 AM
Want to delete directory, subdirectories and all files which are older than 7 days vinodkmpal AIX 1 10-16-2012 05:41 PM
Delete files older than 10 Days in a directory rajeshjohney Shell Programming and Scripting 9 05-25-2012 10:31 AM
Files older than 50 days alok.behria UNIX for Dummies Questions & Answers 4 07-25-2011 04:13 PM
find files older than 30 days old omonoiatis9 UNIX for Advanced & Expert Users 8 06-29-2011 07:19 AM
Finding directories older than 5 days mytempid07 Shell Programming and Scripting 4 04-27-2010 07:50 AM
List the files which are older than 7 days smr_rashmy Shell Programming and Scripting 3 09-16-2009 11:45 PM
Script for parsing directories one level and finding directories older than n days ejianu Shell Programming and Scripting 5 08-26-2009 12:24 PM
Copying files older then 2 days Skovsen Solaris 4 11-07-2008 03:57 AM
Delete files older than 30 days tlphillips UNIX for Dummies Questions & Answers 3 07-24-2008 06:11 PM
Deleting / finding files older than X days missess a day guruparan18 Shell Programming and Scripting 4 05-08-2008 07:09 AM
Finding cumulative size of files older than certain days rohan076 Shell Programming and Scripting 1 04-28-2008 02:07 PM
List directory 7 days older krishnarao Shell Programming and Scripting 3 06-28-2007 02:06 PM
All times are GMT -4. The time now is 11:51 AM.

Unix & Linux Forums Content Copyright 1993-2018. All Rights Reserved.