Shell to remove files of two days ago or later

Hello experts and gurus,
can someone tell me where can I find a documentation or web page that shows an easy and simple way to remove old files by date (for example, remove files older than 2 days: for example, if today is monday, I need to remove files from saturday or later). I researched but didn't find it. I am not shell script expert, but I'm studying linux.
Many thanks,

There was actually no need to limit the search results to regular files and then remove directories and their contents recursively. The find command has a few action commands built-in, which does not need to pass results to an external program for processing. Please see the following:
Terminal - Example
# su - dude
$ touch testFile1 testfile2 TESTfile3
$ find ./ -type f -iname 'testfile*' -ls -delete
261742    0 -rw-rw-r--   1 dude     dude            0 Nov 28 08:41 ./testfile2
261747    0 -rw-rw-r--   1 dude     dude            0 Nov 28 08:41 ./TESTfile3
261689    0 -rw-rw-r--   1 dude     dude            0 Nov 28 08:41 ./testFile1
$ find ./ -type f -name "testfile*" -ls -delete
$
Also note the effect of single and double quoting the find name argument and command line globbing, which many Linux/Unix system administrators with a MS Windows background may not be aware off. The shell resolves wildcards and variables rather than passing the argument to the find command unless it is single quoted:
Terminal - Example
$ touch 'test$File1' 'test$file2' 'TEST$file3'
$ mkdir test
$ find ./ -type f -iname 'test$file*' -ls
261689    0 -rw-rw-r--   1 dude     dude            0 Nov 28 08:53 ./test$File1
261747    0 -rw-rw-r--   1 dude     dude            0 Nov 28 08:53 ./TEST$file3
261742    0 -rw-rw-r--   1 dude     dude            0 Nov 28 08:53 ./test$file2
$ find ./ -type f -iname test$file* -ls
find: paths must precede expression: test$File1
$ strace find ./ -type f -iname test$file* -ls
execve("/bin/find", ["find", "./", "-type", "f", "-iname", "test", "test$File1", "test$file2", "-ls"]
$ strace find ./ -type f -iname 'test$file*' -ls
execve("/bin/find", ["find", "./", "-type", "f", "-iname", "test$file*", "-ls"]
$ strace find ./ -type f -iname "test$file*" -ls
execve("/bin/find", ["find", "./", "-type", "f", "-iname", "test*", "-ls"]

Similar Messages

  • I can't clear my history anymore. Just started doing this two days ago. Even setting auto history clearing didn't help. Will I have to remove/reinstall?

    I can no longer clear my history. I have done this every day for years, and since two days ago The clear history box wont open when I try to clear my history. I tried setting the auto clear option, but that also did not work.
    Is there anything else I can try within firefox or my computer, or will I need to remove firefox and then reinstall it?
    Thank you

    See the article here...
    * http://kb.mozillazine.org/Locked_or_damaged_places.sqlite

  • I purchased two days ago the conversion utility from pdf to Word. I can't use it and need a refund. My files consist of very unusual font symbols and the conversion doesn't work correctly.

    I NEED A REFUND  for the conversion utility that  purchased two days ago.l It is because my files consist almost completely of unusual font symbols that I cannot get into the right place on my current computer. I will have to do the conversion manually. It is not Adobe's fault. How do I obtain a refund?

    The subscription has been canceled & refunded. You will get the money within 4 to 5 days. The case # assigned to it is  213516635.
    Please feel free to contact in case of any issue.
    Regards
    Rajshree

  • I used to be able to get onto a site, but two days ago I no longer can. I have talked with the site Admin and he says the site is viewing me as non-legit.

    I used to frequent an RPing site until two days ago on Sunday, January 26th, 2014. After speaking with the Site admin I was told that the site no longer recognized me as a "legit person". I have gone through all the normal steps, updating, uninstall and re-install Firefox, delete cookies and history, removed proxy for connection (and all the other proxy options) and even restarting the computer. I have tried accessing the site on other browsers, IE and Chrome and it works just fine! I even have other friends who can still use the site on Firefox! I do not know how to fix the problem, and I hate Chrome/IE with a passion, so I am praying there is some way to fix this problem and let me use Firefox again for the site. As for the error I get whenever I try to get to the site it reads. "The requested URL "(Site Address)" cannot be found or is not available. Please check the spelling or try again later."

    Hello,
    Certain Firefox problems can be solved by performing a ''Clean reinstall''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
    '''Note:''' You might want to print these steps or view them in another browser.
    #Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
    #After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
    #Delete the Firefox installation folder, which is located in one of these locations, by default:
    #*'''Windows:'''
    #**C:\Program Files\Mozilla Firefox
    #**C:\Program Files (x86)\Mozilla Firefox
    #*'''Mac:''' Delete Firefox from the Applications folder.
    #*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
    #Now, go ahead and reinstall Firefox:
    ##Double-click the downloaded installation file and go through the steps of the installation wizard.
    ##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
    Please report back to see if this helped you!
    Thank you.
    <!-- VERY important to include-->
    <b>WARNING:</b> Do not run Firefox's uninstaller or use a third party remover as part of this process, because that could permanently delete your Firefox data, including but not limited to, extensions, cache, cookies, bookmarks, personal settings and saved passwords. <u>These cannot be recovered unless they have been backed up to an external device!</u>

  • Two days ago Mail stopped sending my emails.

    Two days ago Mail stopped sending my emails. I am using OS 10.10.2. Connection Doctor shows the connections as green. I can send from my iPhone in iOS, but from my Mack Book Pro, nothing sends. What changed? How do I fix this. I get an error message saying "The identity of smtp.cox.net cannot be verified. The certificate for this server is invalid. … When I ask it to connect anyway, or try the send again, I get a second message saying "Cannot send message using server smtp.cox.net… Authentication required."
    Connection doctor says "Connection to server succeeded; login not required."
    How do I fix this?

    This could be a complicated problem to solve, as there are several possible causes for it.
    Back up all data, then take each of the following steps that you haven't already taken. Stop when the problem is resolved.
    Step 1
    From the menu bar, select
               ▹ System Preferences... ▹ Date & Time
    Select the Time Zone tab in the preference pane that opens and check that the time zone matches your location. Then select the Date & Time tab. Check that the data and time shown (including the year) are correct, and correct them if not.
    Check the box marked 
              Set date and time automatically
    if it's not already checked, and select one of the Apple time servers from the menu next to it.
    Step 2
    Start up in safe mode and log in to the account with the problem.
    Note: If FileVault is enabled in OS X 10.9 or earlier, or if a firmware password is set, or if the startup volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
    The login screen appears even if you usually login automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    If the problem is not reproducible in safe mode, then it's caused by third-party "anti-virus" or "security" software. If you know what that software is, remove it as directed by the developer after backing up all data. If you don't know what it is, ask for instructions.
    Step 3
    Triple-click anywhere in the line below on this page to select it:
    /System/Library/Keychains/SystemCACertificates.keychain
    Right-click or control-click the highlighted line and select
              Services ▹ Show Info
    from the contextual menu.* An Info dialog should open. The dialog should show "You can only read" in the Sharing & Permissions section.
    Repeat with this line:
    /System/Library/Keychains/SystemRootCertificates.keychain
    If instead of the Info dialog, you get a message that either file can't be found, reinstall OS X.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination command-C. Open a TextEdit window and paste into it by pressing command-V. Select the line you just pasted and continue as above.
    Step 4
    Launch the Keychain Access application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    In the upper left corner of the window, you should see a list headed Keychains. If not, click the button in the lower left corner that looks like a triangle inside a square.
    In the Keychains list, there should be items named System and System Roots. If not, select
              File ▹ Add Keychain
    from the menu bar and add the following items:
    /Library/Keychains/System.keychain
    /System/Library/Keychains/SystemRootCertificates.keychain
    Open the View menu in the menu bar. If one of the items in the menu is
              Show Expired Certificates
    select it. Otherwise it will show
              Hide Expired Certificates
    which is what you want.
    From the Category list in the lower left corner of the window, select Certificates. Look carefully at the list of certificates in the right side of the window. If any of them has a blue-and-white plus sign or a red "X" in the icon, double-click it. An inspection window will open. Click the disclosure triangle labeled Trust to disclose the trust settings for the certificate. From the menu labeled
              Secure Sockets Layer (SSL)
    select
              no value specified
    Close the inspection window. You'll be prompted for your administrator password to update the settings.
    Now open the same inspection window again, and select
              When using this certificate: Use System Defaults
    Save the change in the same way as before.
    Revert all the certificates with non-default trust settings. Never again change any of those settings.
    Step 5
    Select My Certificates from the Category list. From the list of certificates shown, delete any that are marked with a red X as expired or invalid.
    Export all remaining certificates, delete them from the keychain, and reimport. For instructions, select
              Help ▹ Keychain Access Help
    from the menu bar and search for the term "export" in the help window. Export each certificate as an individual file; don't combine them into one big file.
    Step 6
    From the menu bar, select
              Keychain Access ▹ Preferences... ▹ Certificates
    There are three menus in the window. Change the selection in the top two to Best attempt, and in the bottom one to  CRL.
    Step 7
    Triple-click anywhere in the line of text below on this page to select it:
    /var/db/crls
    Copy the selected text to the Clipboard by pressing the key combination command-C. In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.
    A folder named "crls" should open. Move all the files in that folder to the Trash. You’ll be prompted for your administrator login password.
    Restart the computer, empty the Trash, and test.
    Step 8
    Triple-click anywhere in the line below on this page to select it:
    open -e /etc/hosts
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Launch the built-in Terminal application in the same way you launched Keychain Access.
    Paste into the Terminal window by pressing command-V. I've tested these instructions only with the Safari web browser. If you use another browser, you may have to press the return key after pasting. A TextEdit window should open. At the top of the window, you should see this:
    # Host Database
    # localhost is used to configure the loopback interface
    # when the system is booting.  Do not change this entry.
    127.0.0.1                              localhost
    255.255.255.255          broadcasthost
    ::1                                        localhost
    If that's not what you see, post the contents of the window.

  • HT1351 Two days ago most of my music dissapeared from my Ipod, however all of it is still in my iTunes Library. After synchronizing the Ipod there is ahuge difference between both music inm my library and the one in the Ipod.

    Two days ago most of my music dissapeared from my Ipod, however all of it is still in my iTunes Library. After synchronizing the Ipod there is a huge difference between both music in my library and the one in the Ipod.

    Hi Rodobaldo,
    Let's try to clear up this issue for you, I'd like to clear out the music on your iPod first. You'll want to find the Sync Music Checkbox, uncheck it, then Apply or Sync:
    Once you have done that, recheck the "Sync Music" checkbox, and apply the changes once more. This will instruct iTunes to completely remove all music from your iPod nano, and then copy the files once more. If you have a large amount of music, this initial sync may take a while.
    If the above does not resolve your issue, see the following article:
    iTunes: Syncing media content to iPod
    http://support.apple.com/kb/HT1351
    Thanks,
    Matt M.

  • I have been using Safari for years and have always kept it on "private." Starting two days ago, I suddenly found myself unable to log onto my blog and many other sites that I normally log onto when private is set. Why?

    I have been using Safari for years and have always kept it on "private." Starting two days ago, I suddenly found myself unable to log onto my blog and many other sites that I normally log onto when private is set. This so annoying, I just switched to Firefox. I don't like Firefox nearly as much as I like Safari. What is happening? How do I fix the problem?
    Thank you.

    Might be a corrupted database ...
    Open a Finder window. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following:
    ~/Library/Caches/com.apple.Safari/Cache.db
    Click Go then move the Cache.db file to the Trash.
    Quit and relaunch Safari to test.

  • I purchased an annual subscription to Acrobat Pro XI and installed two days ago. I cannot open PDFs. I keep getting a dialogue box saying my trial has ended and asking if I want to buy the software. Was using Acrobat Pro 9 previously. It appears even that

    I purchased an annual subscription to Acrobat Pro XI and installed on my Mac two days ago. I cannot open PDFs. I keep getting a dialogue box saying my trial has ended and asking if I want to buy the software. Was using Acrobat Pro 9 previously. It appears even that won't open. SOS!

    Hi Margot ,
    You can click on accept or buy ,which ever option you see on that dialog box.It will prompt you to type in your Adobe Credentials.You can license it by doing the same.
    If it still doesn't work ,follow these steps and see how it goes .
    Delete all the files from following folders:
    [Home]/Library/Application Support/Adobe/SLStore
    [Home]/Library/Application Support/Adobe/SLCache
    And, delete all files from following folder except cache.db
    [Home]/Library/Application Support/Adobe/AdobePCD
    Then launch Acrobat and try to activate and check.
    Regards
    Sukrit Dhingra

  • Two days ago, I lost a bunch of my contacts, appointments on my calendar, and my mail is working differently on iPhone! What happened? I didn't change anything! This has happened to other people I know too. How do I get my stuff back?!

    Two days ago, I lost a bunch of my contacts, appointments on my calendar, and my mail is working differently on iPhone! What happened? I didn't change anything! This has happened to other people I know too. How do I get my stuff back?! Did Apple change/update something? Is it an iCloud issue? HELP!

    We are itunes users just like you.
    You should transfer all purchases to your computer.  File>Devices>Transfer Purchases
    You can redownload some purchases in some countries:
    Download previous purchases from the iTunes Store - Support - Apple

  • Firefox is blocking access to my Picassa albums and I can't post new pictures to it. It just started two days ago. I looked at the opitions and my picassa site is listed as ALLOW but it doesn't work. Can someone tell me a solution? Thanks.

    I use Firefox to load pictures into my Picassa Albums. Two days ago when I tried to make a new album, Firefox repeatedly block Picassa. I checked in the Options box and my Picassa site was listed to ALLOW but it will not allow. How do I fix this problem so I can use Picassa?
    Thanks,
    David

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"

  • Since installing the latest update of Photoshop CC two days ago, Auto Blend for focus stacking is selecting all pixels from the bottom layer instead of selecting the ones in best focus from each layer. Has anyone else seen this problem?

    I installed the latest update of Photoshop CC two days ago on my Macbook Pro, and now when I try to do focus stacking by opening multiple photos and doing Auto Align and Auto Blend, the blend selects the entire bottom layer instead of selecting the in-focus areas from each layer. I even tried again on a series of images where this worked a week ago and the problem occurs. I have Photoshop on a Windows 8 machine and did not apply this latest update and it works fine. Has anyone else encountered this?

    And since installing this same update, my Photoshop is crashing just after starting.
    Ashutosh.Nigam suggested me in this forum to change the permissions to SLStore & SLCache Folder, but it did not work.
    Ali from french Adobe support told me to delete my Settings files, but it was not enough.
    A girl with no name from the same team told me to update my video card driver, but you know I run the latest Mac OS X version and everything is updated, mademoiselle.
    Stephane sent me a link to a huge page of things to do :
    -  Troubleshoot account-specific fonts, but there wasn't any corrupted font
    - Delete account-specific Adobe cache files but... guess what...
    - Troubleshoot account-specific login items but... yes, that's it, I can see you understand me
    - Reset the access settings on the user account's Library folder... oh god, that was fun, I used the Terminal and sudo commands
    I did all of these things because when I tried to open PhCC in an other admin session, it worked, so that was an incompatibility between my session and PhCC. But, but, but, when I tried again to lauch the app in the second session, it worked fine but refused to quit. Ha ha ha.
    So you can try to delete your Settings files. I wish it'll work for you. If not you can try the long list above... or hope a better answer from the support.
    I didn't change anything but Photoshop on my session and they ensure that the bug is due to my session and not to their update. Strange affair.
    Good luck,
    JLuc

  • TS1574 The video and sound was working on my computer two days ago (and has ALWAYS worked on my computer since purchasing it in 2010) but now for some reason I can't play video and there is no sound.  I updated software today.  Still sound & video not wor

    The video and sound was working on my computer two days ago (and has ALWAYS worked on my computer since purchasing it in 2010) but now for some reason I can't play video and there is no sound.  I updated software today.  Still sound & video not working.
    Please help.

    One of the following steps should help.
    1. Install Adobe Flash Player.
        http://get.adobe.com/flashplayer/
        Restart computer. Relaunch Safari.
    2.  Enable Plug-ins
        Safari > Preferences > Security
        Web Content:
        Click in the box for "Enable Plug-ins".
    3. Check  whether you are currently  in  YouTube HTML 5 trial.
         http://www.youtube.com/html5
        At the bottom  left of the page  uncheck the box for
       "You are currently in the HTML5 trial".
    4. Reset Safari.
        Click Safari in the menu bar.
        From the drop down select "Reset Safari".
        Uncheck the boxes next to all items.
        Check the box next to "Remove all website data".
        Click "Reset".
    5. Turn off Extensions/Plug-ins if any that may interfere with Flash working properly.
        Safari > Preferences > Extensions
    Best.

  • Suddenly command-shift-3 does not produce a screenshot. Two days ago, no problem. Any suggestions?

    Why does command-shift-3 no longer produce a screenshot? Two days ago, no problem. This evening the keys click and nothing happens. I'm in OSX 10.9.1.

    The key combination for saving a screenshot to a file is command-shift-3 or 4. If you press command-control-shift-3 or 4, the image will be copied to the Clipboard, and no file will be created.

  • TS1702 My iphone has displayed a warning message two days ago that if i dont ..... i cannot purchase anymore applications but I could not read the first sentence and now I am unable to purchase

    My iphone has displayed a warning message two days ago that if i dont ..... i cannot purchase anymore applications but I could not read the first sentence and now I am unable to purchase

    That error message suggest you have a permissions issue. Make sure you have full read/write privileges for the Drive/ Folder location that you are copying the files to. 

  • I have a Mac OS X Snow Leopard.  For some unknown reason the Library application in Finder disappeared and I was using it only two days ago.  Please could someone help?  Thanks.

    I have a Mac OS X Snow Leopard.  For some unknown reason the Library application in Finder disappeared and I was using it only two days ago.  Please could someone help?  Thanks.

    Hi cb-anc!  Thank you for replying to my question.  The Library application has disappeared,not the library folder.  I went into the application a couple of days ago to trash some plist files and now the application has disappeared. I haven't upgraded to Lion but am still on now Leopard.

Maybe you are looking for