wrong script and syntax trouble - terminal

goal:
find all documents (texts, pdfs, fotos, etc) on my computer (located in different files) which were changed after a specific date and copy them to a different file,
that's what I typed in a terminal:
find . maxdepth 1 -newermt 2022-02-26 -exec / cp /Schreibtisch/new files after feb 28
as a response I get: missing argument for -exec
cant find the error, pls help
tx,
michael

Related

How can I find log files only within 2 minutes of current time from log folder

I am beginner to shell
I Have one log Folder where logs are getting generated in format as:
ACS_1/ACS1_Events_OG_Multiple_20200126_014453.log
ACS_2/ACS1_Events_OG_Multiple_20200126_014300.log
ACS_3/ACS1_Events_OG_Multiple_20200126_020553.log
I want to find logs which are falling in between 2 minutes of time (014315 to 014515)
I tried to use
find . -name "ACS1_Events_OG_Multiple_20200126_01[4][3,5]*"
but I'm not getting exact result, I have to create automated logs between any given time range.
so you can use cmin, just specify whether you want the time to be smaller or greater or equal to the time you want, using, respectively:
#smaller - you have to use - before your time
find your-location -cmin -your-time
#greater - you have to use + before your time
find your-location -cmin +your-time
#equal
find your-location -cmin your-time
for example we wanna check 2 minutes from current time
find . -iname "ACS1_Events_OG_Multiple_*.log" -cmin -2
or even better, for example as you wrote you have ACS1 ACS2 ACS3 so better to use ? instead of number, like this :
find . -iname "ACS?_Events_OG_Multiple_*.log" -cmin -2
good luck

Grep file after loaded after a particular minute

Can anyone please help me in getting the command to search files loaded after a particular minute.
Example:-
I want the files loaded after the time 2017/02/15.11.
That means all the files loaded after 11
First, you need to convert you custom date into a recognizable date format:
DATE="2017/02/15.11"
TIME="${DATE##*.}:00"
DATE="${DATE%.*}"
echo "DATE: ${DATE} TIME: ${TIME}"
Then just pass it to find:
find /dir -newermt "${DATE} ${TIME}"

Mage::getStoreConfig not returning updated values

Recently we've noticed that Mage::getStoreConfig is not returning updated values in a app/code/local plugin. Everything was working as of last Friday so we assume that something has changed on the server.
We can see the values updating correctly in the database table core_config_data.
We have
recompiled
flushed the Magento Cache
flushed the Cache Storage
reset folder and file ownership and permissions
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
For example, we added an extra character to the store phone number, see that the database value has updated but it doesn't show with the following line
Mage::getStoreConfig('general/store_information/phone')
As a test we duplicated the site and database via Plesk and applied the latest patches to both sites. The duplicated site worked as normal.
I'm intrigued to find out what has happened so any ideas as to what the issue might be would be welcome?

Finding the files which are not accessed/modified in last 30min?

I've one requirement, i want to give the notifications to the users who have not accessed the files in 30 min. using the shell script. Is it possible to find the files which was not accessed in 30 min using find. I'd checked.
find /opt/SP/tibmft/scripts/ -mtime 0
which will fetch the files which was modifed in last 24 hours.
My requirement is fetch the files which was created in the last 30 min and not been accessed by the user? Please suggest the solution, how to achieve this?
Try using
find PATH -cmin -30 -and -amin +30
Is it possible to find the files which was not accessed in 30 min using find.
According to man find:
Numeric arguments can be specified as
+n for greater than n,
-n for less than n,
n for exactly n.
Please note, this is greater and less not greater/less or equal. So, you have to take some care in order to not have a 1 minute error due to that:
find PATH -not -amin +30
or
find PATH -amin -31
My requirement is fetch the files which was created in the last 30 min and not been accessed by the user?
Here is an attempt:
find PATH -amin -31 -not -newerBt "-30 minutes"
# ^^^^^^^^
# (B)irth date newer (t)han ...
... unfortunately, it does not work on my computer with ext4 file-system, as, to quote a comment by Barmar above: "Most Unix file-systems don't record file creation time. They just have modification, access, and inode change times."
Some random ideas:
According to one of your comment, this is potentially a periodic task. So one might investigate the use of a cron job to record the list of files at regular intervals?
If your file-system has snapshots you might build on that too. Maybe.
Try the following:
find $PATH -type f -cmin -30 amin +30

Find directories created less than a week ago

I know I can use this command to find directories created or modified less than a week ago:
find /home -type d -mtime -7
But how do I find directory that were created less than a week ago?
Creation time is not stored.
There is only 3 timestamps you can check
Last access time
Last modification time
Last change time
"Change" is one of: permission changes, rename etc.
While the modification is contents only.
Short answer: you can't.
There are three times stored in an inode
ctime: time of creation or change of the inode
mtime: time of last change of the file that the inode refers to
atime: time of last access to the file
The point is: ctime is altered not only by create, but also by chmod / chown, maybe even by ln (not sure). Man stat and man touch are your friends.
If you try to find fresh directories by means of find /home -type d -mtime -7 be prepared to also find older directories that had their mode or owner changed.

Resources