4 added tag ' OSX' of importance to understand a comment by OP + menial corrections on wording
source | link

I'd like to find the MAIN.TXT file in a directory folder. If it is older than 24hours then output YES to the MAIN.txt file. If it hasn't been modified in 24hours then leave the file alone.

I got as far as this:

find /directory -type f -mtime +1 -exec echo 'YES' > /directory/MAIN.txt \;

The MAIN.TXT file is older than 24hours24 hours, so it works. This updates MAIN.TXT mod time to the current time and my MAIN.txt file has YES in it.

If MAIN.TXT is lessnewer than 24hours old, it still modifies the MAIN.TXT with blank txt and changed the modification time.

I know I need a conditional, but I can't seem to get where it goes. Additionally, my mentor mentioned {} for my ECHO parameter but if I do that, then I get the filename with AVAILABLE appended.

I'd like to find the MAIN.TXT file in a directory folder. If it is older than 24hours then output YES to the MAIN.txt file. If it hasn't been modified in 24hours then leave the file alone.

I got as far as this:

find /directory -type f -mtime +1 -exec echo 'YES' > /directory/MAIN.txt \;

The MAIN.TXT file is than 24hours, so it works. This updates MAIN.TXT mod time to the current time and my MAIN.txt file has YES in it.

If MAIN.TXT is less than 24hours old, it still modifies the MAIN.TXT with blank txt and changed the modification time.

I know I need a conditional, but I can't seem to get where it goes. Additionally, my mentor mentioned {} for my ECHO parameter but if I do that, then I get the filename with AVAILABLE appended.

I'd like to find the MAIN.TXT file in a directory folder. If it is older than 24hours then output YES to the MAIN.txt file. If it hasn't been modified in 24hours then leave the file alone.

I got as far as this:

find /directory -type f -mtime +1 -exec echo 'YES' > /directory/MAIN.txt \;

The MAIN.TXT file is older than 24 hours, so it works. This updates MAIN.TXT mod time to the current time and my MAIN.txt file has YES in it.

If MAIN.TXT is newer than 24hours old, it still modifies the MAIN.TXT with blank txt and changed the modification time.

I know I need a conditional, but I can't seem to get where it goes. Additionally, my mentor mentioned {} for my ECHO parameter but if I do that, then I get the filename with AVAILABLE appended.

3 deleted 90 characters in body
source | link

I've reached a roadblock with the find command in Linux. I'm hoping someone can help.

I'd like to find the MAIN.TXT file in a directory folder. If it is older than 24hours then output YES to the MAIN.txt file. If it hasn't been modified in 24hours then leave the file alone.

I got as far as this:

find /directory -type f -mtime +1 -exec echo 'YES' > /directory/MAIN.txt \;

The MAIN.TXT file is than 24hours, so it works. This updates MAIN.TXT mod time to the current time and my MAIN.txt file has YES in it.

If MAIN.TXT is less than 24hours old, it still modifies the MAIN.TXT with blank txt and changed the modification time.

I know I need a conditional, but I can't seem to get where it goes. Additionally, my mentor mentioned {} for my ECHO parameter but if I do that, then I get the filename with AVAILABLE appended.

I've reached a roadblock with the find command in Linux. I'm hoping someone can help.

I'd like to find the MAIN.TXT file in a directory folder. If it is older than 24hours then output YES to the MAIN.txt file. If it hasn't been modified in 24hours then leave the file alone.

I got as far as this:

find /directory -type f -mtime +1 -exec echo 'YES' > /directory/MAIN.txt \;

The MAIN.TXT file is than 24hours, so it works. This updates MAIN.TXT mod time to the current time and my MAIN.txt file has YES in it.

If MAIN.TXT is less than 24hours old, it still modifies the MAIN.TXT with blank txt and changed the modification time.

I know I need a conditional, but I can't seem to get where it goes. Additionally, my mentor mentioned {} for my ECHO parameter but if I do that, then I get the filename with AVAILABLE appended.

I'd like to find the MAIN.TXT file in a directory folder. If it is older than 24hours then output YES to the MAIN.txt file. If it hasn't been modified in 24hours then leave the file alone.

I got as far as this:

find /directory -type f -mtime +1 -exec echo 'YES' > /directory/MAIN.txt \;

The MAIN.TXT file is than 24hours, so it works. This updates MAIN.TXT mod time to the current time and my MAIN.txt file has YES in it.

If MAIN.TXT is less than 24hours old, it still modifies the MAIN.TXT with blank txt and changed the modification time.

I know I need a conditional, but I can't seem to get where it goes. Additionally, my mentor mentioned {} for my ECHO parameter but if I do that, then I get the filename with AVAILABLE appended.

2 edited body
source | link

I've reached a roadblock with the find command in Linux. I'm hoping someone can help.

I'd like to find the MAIN.TXT file in a directory folder. If it is older than 24hours thanthen output YES to the MAIN.txt file. If it hasn't been modified in 24hours thanthen leave the file alone.

I got as far as this:

find /directory -type f -mtime +1 -exec echo 'YES' > /directory/MAIN.txt \;

The MAIN.TXT file is than 24hours, so it works. This updates MAIN.TXT mod time to the current time and my MAIN.txt file has YES in it.

If MAIN.TXT is less than 24hours old, it still modifies the MAIN.TXT with blank txt and changed the modification time.

I know I need a conditional, but I can't seem to get where it goes. Additionally, my mentor mentioned {} for my ECHO parameter but if I do that, then I get the filename with AVAILABLE appended.

I've reached a roadblock with the find command in Linux. I'm hoping someone can help.

I'd like to find the MAIN.TXT file in a directory folder. If it is older than 24hours than output YES to the MAIN.txt file. If it hasn't been modified in 24hours than leave the file alone.

I got as far as this:

find /directory -type f -mtime +1 -exec echo 'YES' > /directory/MAIN.txt \;

The MAIN.TXT file is than 24hours, so it works. This updates MAIN.TXT mod time to the current time and my MAIN.txt file has YES in it.

If MAIN.TXT is less than 24hours old, it still modifies the MAIN.TXT with blank txt and changed the modification time.

I know I need a conditional, but I can't seem to get where it goes. Additionally, my mentor mentioned {} for my ECHO parameter but if I do that, then I get the filename with AVAILABLE appended.

I've reached a roadblock with the find command in Linux. I'm hoping someone can help.

I'd like to find the MAIN.TXT file in a directory folder. If it is older than 24hours then output YES to the MAIN.txt file. If it hasn't been modified in 24hours then leave the file alone.

I got as far as this:

find /directory -type f -mtime +1 -exec echo 'YES' > /directory/MAIN.txt \;

The MAIN.TXT file is than 24hours, so it works. This updates MAIN.TXT mod time to the current time and my MAIN.txt file has YES in it.

If MAIN.TXT is less than 24hours old, it still modifies the MAIN.TXT with blank txt and changed the modification time.

I know I need a conditional, but I can't seem to get where it goes. Additionally, my mentor mentioned {} for my ECHO parameter but if I do that, then I get the filename with AVAILABLE appended.

    Post Migrated Here from serverfault.com
1
source | link