Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Linux find command returns nothing Post 303005135 by jim mcnamara on Friday 13th of October 2017 09:00:23 AM
Old 10-13-2017
How to debug problems like this
steps:
Code:
cd /path/to/files
# are we in the right directory?
pwd  
# filename to find is ABC_DEFGH*
ls -l ABC_DEFGH* |tail -1
# if all of this works out correctly - and you carefully read the date from the ls command
# then the find command you gave will return files

Also note: mtime does this:
filetimes are stored as seconds since Jan 1 1970, which is usually a large number:
Code:
$ date +%s
1507899718

mtime gets that number for right now, then mutiplies the number of seconds, 86400, times the number of days: 20 * 86400 = 1728000.
Next, it subtracts that smaller number of seconds from right now: 1507899718 - 1728000 = 1506171718

So find is really looking for files that have filetimes of 1506171718 or less. Nowhere did I mention anything about calendars. This does not exactly match what your calendar tells you.
You could have a file that is 20 calendar days old but find still would not see it because the calculation is not based on calendars.

Last edited by jim mcnamara; 10-13-2017 at 10:10 AM..
These 3 Users Gave Thanks to jim mcnamara For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cant find command that returns blank line

This is my list of sed commands: can anyone tell me where im going wrong. The script works on a file called data which contains 6 student id's and there answers for 6 questions. !/bin/sh sed -e 's/*//g' \ #replace * with nothing -e s/ /X/g' \ #replacing empty space with X -e... (2 Replies)
Discussion started by: jeffersno1
2 Replies

2. Shell Programming and Scripting

FIND returns different results in script

When I execute this line at the command prompt I get a different answer than when I run it in a script? Any ideas on how to resolve? I'm trying to find all files/dir in a directory except files that start with the word file. Once I get this command to work, I will add the "delete" part to the... (6 Replies)
Discussion started by: blt123
6 Replies

3. UNIX for Dummies Questions & Answers

find command returns files with spaces, mv won't work...

Hi guys. I am trying, to move files found with the find command... Script runs fine, until it reaches a file that contains spaces... Here is what i wrote up quickly. ROOTDIR=/apps/data SEARCH=$(find /data/HDTMPRestore/home/tmq/ -type f -print | grep Mods/Input/bck | cut -c19-) for i... (1 Reply)
Discussion started by: Stephan
1 Replies

4. UNIX for Dummies Questions & Answers

ascii FTP from Linux to Linux adding carriage returns

Hi, I've got an issue with a shell script that FTP's a file from one Linux server to another Linux server. My script runs on a Linux server and creates an output file (from a database call), and then FTP's this file to another Linux server. The problem is that, even though the output file... (0 Replies)
Discussion started by: roysterdoyster
0 Replies

5. Shell Programming and Scripting

How to check if a command returns nothing

Hi, I want to write a script that runs a command (at -l) and writes the output to a file. If the command (at -l) command returns no value (is empty/null) then write a message to the file in place of the command output. My problem is around trapping the empty returned command value and replacing... (2 Replies)
Discussion started by: Alvescot
2 Replies

6. UNIX for Dummies Questions & Answers

echo statement when find returns null

Hi, How do you echo something once when a find statement returns null results? This is when using mutiple locations and mutiple arguments. The below find command the inner loop of a nested for loop where the outter loop holds the $args and the inner loop holds the locations. find... (2 Replies)
Discussion started by: tchoruma
2 Replies

7. Shell Programming and Scripting

find/grep returns no matches

Hi all! I've faced with very unintelligible error using find/grep like this: root@v29221:~# find /var/www/igor/data/www/lestnitsa.ru | grep u28507I get nothing as a result, but: root@v29221:~# grep u28507 /var/www/igor/data/www/lestnitsa.ru/_var.inc $db_name = 'u28507';... (2 Replies)
Discussion started by: ulrith
2 Replies

8. Linux

help in find command in linux

I am trying to find pictures which contains a specific word in the file name. For example any .JPG files that contains "lm" at the beginning or at the middle or at the end of the file name. find / -iname "*.jpg" | ...what should go after the pipe? regards, Moaathe (2 Replies)
Discussion started by: kidwai
2 Replies

9. Shell Programming and Scripting

rm -rf ab returns find: `./ab': No such file or directory

Hi Gurus. This is driving me a bit batty. I now if must be a simple matter but I cant find anything that references it. I have a housekeeping script that searches for some huge dump directories then removes them using rm -rf. find ./ -name 'ab' -exec rm -rf {} \; This works but always... (7 Replies)
Discussion started by: rinser
7 Replies

10. Shell Programming and Scripting

Linux find command seems to not transmit all the result to the '-exec command'

Hello. From a script, a command for a test is use : find /home/user_install -maxdepth 1 -type f -newer /tmp/000_skel_file_deb ! -newer /tmp/000_skel_file_end -name '.bashrc' -o -name '.profile' -o -name '.gtkrc-2.0' -o -name '.i18n' -o -name '.inputrc' Tha command... (3 Replies)
Discussion started by: jcdole
3 Replies
CALENDAR(1)						    BSD General Commands Manual 					       CALENDAR(1)

NAME
calendar -- reminder service SYNOPSIS
calendar [-a] [-A num] [-B num] [-F friday] [-f calendarfile] [-t dd[.mm[.year]]] [-W num] DESCRIPTION
The calendar utility checks the current directory for a file named calendar and displays lines that begin with either today's date or tomor- row's. On the day before a weekend (normally Friday), events for the next three days are displayed. The following options are available: -A num Print lines from today and the next num days (forward, future). -a Process the ``calendar'' files of all users and mail the results to them. This requires super-user privileges. -B num Print lines from today and the previous num days (backward, past). -F friday Specify which day of the week is ``Friday'' (the day before the weekend begins). Default is 5. -f calendarfile Use calendarfile as the default calendar file. -t dd[.mm[.year]] For test purposes only: set date directly to argument values. -W num Print lines from today and the next num days (forward, future). Ignore weekends when calculating the number of days. To handle calendars in your national code table you can specify ``LANG=<locale_name>'' in the calendar file as early as possible. To handle national Easter names in the calendars ``Easter=<national_name>'' (for Catholic Easter) or ``Paskha=<national_name>'' (for Orthodox Easter) can be used. Other lines should begin with a month and day. They may be entered in almost any format, either numeric or as character strings. If the proper locale is set, national month and weekday names can be used. A single asterisk (``*'') matches every month. A day without a month matches that day of every week. A month without a day matches the first of that month. Two numbers default to the month followed by the day. Lines with leading tabs default to the last entered date, allowing multiple line specifications for a single date. ``Easter'', is Easter for this year, and may be followed by a positive or negative integer. ``Paskha'', is Orthodox Easter for this year, and may be followed by a positive or negative integer. Weekdays may be followed by ``-4'' ... ``+5'' (aliases for last, first, second, third, fourth) for moving events like ``the last Monday in April''. By convention, dates followed by an asterisk are not fixed, i.e., change from year to year. Day descriptions start after the first <tab> character in the line; if the line does not contain a <tab> character, it is not displayed. If the first character in the line is a <tab> character, it is treated as a continuation of the previous line. The ``calendar'' file is preprocessed by cpp(1), allowing the inclusion of shared files such as lists of company holidays or meetings. If the shared file is not referenced by a full pathname, cpp(1) searches in the current (or home) directory first, and then in the directory /usr/share/calendar. Empty lines and lines protected by the C commenting syntax (/* ... */) are ignored. Some possible calendar entries (<tab> characters highlighted by sequence) LANG=C Easter=Ostern #include <calendar.usholiday> #include <calendar.birthday> 6/15 June 15 (if ambiguous, will default to month/day). Jun. 15 June 15. 15 June June 15. Thursday Every Thursday. June Every June 1st. 15 * 15th of every month. May Sun+2 second Sunday in May (Muttertag) 04/SunLast last Sunday in April, summer time in Europe Easter Easter Ostern-2 Good Friday (2 days before Easter) Paskha Orthodox Easter FILES
calendar file in current directory ~/.calendar calendar HOME directory. A chdir is done into this directory if it exists. ~/.calendar/calendar calendar file to use if no calendar file exists in the current directory. ~/.calendar/nomail do not send mail if this file exists. The following default calendar files are provided: calendar.all File which includes all the default files. calendar.australia Calendar of events in Australia. calendar.birthday Births and deaths of famous (and not-so-famous) people. calendar.christian Christian holidays. This calendar should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year. calendar.computer Days of special significance to computer people. calendar.croatian Calendar of events in Croatia. calendar.freebsd Birthdays of FreeBSD committers. calendar.french Calendar of events in France. calendar.german Calendar of events in Germany. calendar.history Everything else, mostly U.S. historical events. calendar.holiday Other holidays, including the not-well-known, obscure, and really obscure. calendar.judaic Jewish holidays. This calendar should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year. calendar.music Musical events, births, and deaths. Strongly oriented toward rock 'n' roll. calendar.newzealand Calendar of events in New Zealand. calendar.russian Russian calendar. calendar.southafrica Calendar of events in South Africa. calendar.usholiday U.S. holidays. This calendar should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year. calendar.world Includes all calendar files except for national files. COMPATIBILITY
The calendar program previously selected lines which had the correct date anywhere in the line. This is no longer true, the date is only recognized when it occurs at the beginning of a line. SEE ALSO
at(1), cpp(1), mail(1), cron(8) HISTORY
A calendar command appeared in Version 7 AT&T UNIX. BUGS
The calendar utility does not handle Jewish holidays and moon phases. BSD
June 13, 2002 BSD
All times are GMT -4. The time now is 09:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy