How to clear search history in sidebar?

Discussion in 'OS X' started by Mariux.mac, Apr 26, 2008.

  1. macrumors member

    Joined:
    Feb 11, 2008
    #1
    does any one now how to clear the search history in sidebar?
     
  2. macrumors 6502

    Joined:
    Feb 21, 2008
    #2
    Hi,

    I'd love to help you, but I don't know what you're talking about? Which browser are you using / do you have any plugins installed.

    /Rupert
     
  3. thread starter macrumors member

    Joined:
    Feb 11, 2008
    #3
    no not in broser in finder there are "search for" side bar
     
  4. macrumors 6502

    Joined:
    Feb 21, 2008
    #4
    Ah, alright...

    watch out! These are not history items. These are Smart Folders showing actual content of your hard drive, used Today, Yesterday and so on.

    DON'T delete them or you will run into serious trouble.

    To remove the Smart Folders from the sidebar, just drag them off the sidebar and they will vanish in a puff of smoke.

    /Rupert
     
  5. thread starter macrumors member

    Joined:
    Feb 11, 2008
    #5
    :) when i got my MBP yestorday and whas testing what will happen if i delete search history of side bar :) i now one thing my system prederences stop working :D now i now that there are real files

    whell i just testet like you sed to remove the icon. but in finder preferences you can again add the same for exemple "today" smart folder and the search history is the same.
     
  6. macrumors G3

    TuffLuffJimmy

    Joined:
    Apr 6, 2007
    Location:
    Portland, OR
    #6
    Time to put those disks that you got with your computer in your drive and reinstall everything.

    Never ever delete anything on any computer unless you are sure you know what it is!
     
  7. thread starter macrumors member

    Joined:
    Feb 11, 2008
    #7
    im new to the OS X system, i had 40 mhz, 20 ram, 250mb mac os 8 computer it whas super, ooo those duke nukem 3d times... :)))
     
  8. macrumors newbie

    Joined:
    Jan 19, 2010
    #8
    How to clear search history in sidebar?

    There is an ease way to solve this problem.
    Open "Today" in sidebar - click Info
    Then open "Today" folder using the path (shown in info where):
    /System/Library/CoreServices/Finder.app/Contents/Resources/CannedSearches/Today.cannedSearch
    To view the contents of the Finder.app, right click and click on "Show Package Contents" to see the content, then open the other folders.
    Now you can delete the files of the "Today" folder but before is useful to empty the Trash. After deleting you MUST PUT BACK these files from "Trash" to recovery the deleted files (open Trash, then click "Put Back) because the files are real deleted from original location.
     
  9. macrumors newbie

    Joined:
    Jan 19, 2010
    #9
    How to clear the search history in sidebar

    Open "Today" or "Yesterday" or "Past Week", select All and put in trash, then select All, and "Put Back" using right click menu. If "Put Back" is not visible (depend of kind of file ), select file by file or group of files. This method work also for search and Smart Folder. REMEMBER to "Put Back":) to recover the files in the original position (the files are real deleted). In history are not recovered ;)
     
  10. macrumors 6502a

    Denarius

    Joined:
    Feb 5, 2008
    Location:
    Gironde, France
    #10
    This is really dangerous rubbish in my view. What you see as the Today/Yesterday/Last Week 'folder' are in fact smart queries looking at the document metadata in the filesystem and showing you the real files. If you delete them, they're gone. That's it, end of. On the other hand if you put them back where they belong they'll still have the same date in the file metadata and will still show up in the Today/Yesterday/Past Week searches.

    The only way I can think of is to modify the datestamp within the document metadata, which must be possible as the system does that every time you open the file, but I suspect you need to be an experience OS X developer to make something that can do this.
     
  11. macrumors newbie

    Joined:
    Jan 19, 2010
    #11
    I am sorry, mat this method works.Tray to see !!. Some time fail if the file is protected but I an not understand why. With the same kind of file, the same protection, one is cleared (from ,for instance, "Today") and the other not. I must to investigate
     
  12. macrumors 6502a

    Denarius

    Joined:
    Feb 5, 2008
    Location:
    Gironde, France
    #12
    What version of OS X are you using? This definitely doesn't work on my system which is 10.5.8.

    What does work is to copy the file to a Fat 32 volume, could be a USB flash drive, external hd, whatever. Then delete the original file from the trash, we'll call it filename and the external volume extfat32volume.
    When the file goes from an HFS volume to a fat32 it has to store the file's metadata in a separate file called ._filname
    Now, in terminal:
    Code:
    rm -rf "/Volumes/extfat32volume/._filename"
    
    Finally, drag the file back to it's original location on your hard drive.

    Reckon it'd be fairly straightforward to write an applescript to do this.
     
  13. macrumors 6502a

    Denarius

    Joined:
    Feb 5, 2008
    Location:
    Gironde, France
    #13
    Reliable solution using a FAT32 volume and an Applescript.

    Here's an Applescript to do this with a FAT32 volume attached in order to split off the metadata.

    Code:
    set originalFile to choose file with prompt "Choose a document to clear from sidebar history:"
    set originalPOSIXFilePath to POSIX path of originalFile
    --Set the name of your FAT32 volume in the quotes on the next line
    set otherDisk to "NO NAME"
    tell application "Finder"
    	set originalFilePath to container of originalFile as text
    	copy file originalFile to disk otherDisk
    end tell
    set originalFileName to name of (info for originalFile)
    set destinationFullPath to otherDisk & ":" & originalFileName
    set destinationMDFullPath to otherDisk & ":._" & originalFileName
    set copiedFile to alias destinationFullPath
    set copiedFileMD to alias destinationMDFullPath
    tell application "Finder"
    	delete originalFile
    	delete copiedFileMD
    	copy file copiedFile to alias originalFilePath
    	delete copiedFile
    end tell
    delay 0.5
    --last part modifies the POSIX last access time to complete the job
    do shell script "touch -a -t 200901010715 " & originalPOSIXFilePath
    Probably one of the most useless things I've ever done, but interesting nevertheless. :rolleyes:
     
  14. macrumors 6502a

    Denarius

    Joined:
    Feb 5, 2008
    Location:
    Gironde, France
    #14
    Here's a rock solid solution exploiting the fact that gzip compression doesn't support OS X document metadata. the POSIX aTime is also changed for the sake of being thorough.

    Code:
    on hide_item(fileToProcess)
    	set posixPath to POSIX path of fileToProcess
    	do shell script "touch -a -t 200901010730 " & "'" & posixPath & "'"
    	do shell script "gzip " & "'" & posixPath & "'"
    	do shell script "gzip -d " & "'" & posixPath & ".gz'"
    end hide_item
    
    on run
    	set anItem to choose file with prompt "Choose a document to clear from sidebar history:"
    	hide_item(anItem)
    end run
    
    on open itemsToHide
    	repeat with anItem in itemsToHide
    		hide_item(anItem)
    	end repeat
    end open
    
    Paste the into script editor, save it as file format Application bundle and drag it into the dock. You can run it either by clicking or by dragging the item(s) you wish to remove onto the icon in the dock.
     
  15. macrumors 6502a

    Denarius

    Joined:
    Feb 5, 2008
    Location:
    Gironde, France
    #15
    This is a new version that uses ditto to strip the resource fork. Know issue is that it can't deal with directories correctly.

    Code:
    on hide_item(fileToProcess)
    	set posixPath to replaceChar(POSIX path of fileToProcess, "\"", "\\\"")
    	do shell script "touch -a -t 200901010730 " & "\"" & posixPath & "\""
    	do shell script "ditto --norsrc \"" & posixPath & "\" tmpfile.jpg && mv tmpfile.jpg " & "\"" & posixPath & "\""
    end hide_item
    
    on replaceChar(theString, oldChar, newChar)
    	set oldDelimiters to AppleScript's text item delimiters
    	set AppleScript's text item delimiters to oldChar
    	set theArray to every text item of theString
    	set theNewString to ""
    	repeat with i from 1 to length of theArray
    		set stringPart to item i of theArray
    		set theNewString to theNewString & stringPart
    		if i is less than length of theArray then set theNewString to theNewString & newChar
    	end repeat
    	return theNewString
    end replaceChar
    
    on run
    	set anItem to choose file with prompt "Choose a document to clear from sidebar history:" without invisibles
    	hide_item(anItem)
    end run
    
    on open itemsToHide
    	repeat with anItem in itemsToHide
    		hide_item(anItem)
    	end repeat
    end open
    
     
  16. macrumors 6502a

    Denarius

    Joined:
    Feb 5, 2008
    Location:
    Gironde, France
    #16
    Final version (I think).

    After all this reading, the solution to the original problem posted by the OP was a resource fork stripper, which I have inadvertently reinvented. :confused: Oh well, here it is anyway. It now works on both files and directories, getting rid of the resource forks of all selected files or within the chosen directory. It seems to work quite well, but comments welcome!

    Code:
    --Main handler for the script.
    on hideItem(pathAlias)
    	--Get the path to use in the shell command from the alias of the file.
    	set posixPath to POSIX path of pathAlias
    	set quotedPosixPath to quoted form of posixPath
    	--Checks that the path is to a file and not a directory and proceeds.
    	if isPOSIXDirectoryPath(posixPath) is false then
    		do shell script "touch -a -t 200901010730 " & quotedPosixPath & " && ditto --norsrc " & quotedPosixPath & " tmpfile.jpg && mv tmpfile.jpg " & quotedPosixPath
    	else
    		do shell script "touch -a -t 200901010730 " & quotedPosixPath & " && ditto --norsrc " & quotedPosixPath & " tmpfile && rm -rf " & quotedPosixPath & " && mv tmpfile " & quotedPosixPath
    	end if
    end hideItem
    
    -- Checks whether the POSIX path given points to a directory or a file. True if directory.
    on isPOSIXDirectoryPath(thePath)
    	if last character of thePath is "/" then
    		set theResult to true
    	else
    		set theResult to false
    	end if
    	return theResult
    end isPOSIXDirectoryPath
    
    -- Displays a prompt to select a file in the event that the script is double-clicked.
    on run
    	set anItem to choose file with prompt "Choose a document to clear from sidebar history:" without invisibles
    	hideItem(anItem)
    end run
    
    -- Provides droplet functionality.
    on open itemsToHide
    	repeat with anItem in itemsToHide
    		hideItem(anItem)
    	end repeat
    end open
    
    
     
  17. macrumors regular

    Nero Wolfe

    Joined:
    Oct 28, 2007
    Location:
    Atlanta, GA
    #17
    Another way to keep stuff out of there is to add whatever folders contain sensitive items (or whatever you don't want showing up) to the privacy list in Spotlight.
     
  18. macrumors newbie

    Joined:
    May 21, 2011
    #18
    That works Nero!

    Using the spotlight and adding the folders to Privacy - removed all sensitive files from the search -- today, yesterday, etc!

    Thanks!
     
  19. macrumors newbie

    Joined:
    May 30, 2012
    #19
    Simply...

    To clear history, you simply click 'History' tab at the top of your screen, click on it to open it, and at the bottom of the tab, there is an option to 'Clear History...' simply click that and there you go. Now for the sidebar, you click the little magnifying glass in the far left corner of the side bar, and just above your variety of different search engines you can use, there is an option to 'Clear Recent Searches' and presto, you've cleared your computer history and recent searches. Glad I could be of service. Any questions, comments, or concerns, ask away.:)
     

Share This Page