Strip resource forks and .DS_Store files from folder

I'm transferring stuff from my Mac to a Windows machine using a FAT32 formatted keydrive, and want to eliminate the various dot files from folders before I copy them to the Windows box. I had tried using a Terminal command, which was tedious and at one point I mistyped something and managed to nuke one of the folders on the drive. After a search, I found this script at MacOSXHints:
on run
display dialog "Drag a removable disk icon here to have it cleaned and ejected"
end run
on open selectedItem
-- get a text version of the volume name and remove the trailing colon :
set volumeName to selectedItem as string
set volumeName to characters 1 thru (the (length of volumeName) - 1) of volumeName as string
if (list disks) contains volumeName then
do shell script "find '/Volumes/" & volumeName & "' -name '.DS_Store' -exec rm '{}' \\;"
do shell script "find '/Volumes/" & volumeName & "' -name '._*' -exec rm '{}' \\;"
try
do shell script "rm -rd '/Volumes/" & volumeName & "/.Trashes'"
do shell script "rm -rd '/Volumes/" & volumeName & "/.TemporaryItems'"
end try
try
tell application "Finder" to eject disk volumeName
end try
end if
end open
It worked great, but took a bit of time to run. I no longer need to clean the whole drive again, just specific folders I add to the drive now. Unfortunately I don't actually know how to write Applescript, I can just sometimes adapt an existing script to my needs, but this adaptation is beyond my meagre abilities. Last night I was copying a couple of folders to the drive, then using the Terminal "find execute remove" command to get rid of the dot files after the fact. I would like to have an Applescript droplet, so that I drop the folder onto it and the resource forks are stripped off and the .DS_Store files are removed before I copy the folder to the key drive.
Any help appreciated!
Francine
Francine
Schwieder

Make a duplicate of the folder you want to transfer on your hard disk, and then run the following on the duplicate:
on open droppedItems
repeat with anItem in droppedItems
if (folder of (info for anItem)) is false then
display dialog (anItem as string) & " was not proccessed." & return & return & "Folders only please"
else
do shell script "find " & quoted form of POSIX path of anItem & " -name \".DS_Store\" -exec rm '{}' \\;"
do shell script "find " & quoted form of POSIX path of anItem & " -name \"._*\" -exec rm '{}' \\;"
do shell script "ditto --norsrc " & quoted form of POSIX path of anItem & " '/Volumes/volumename/pathname/'"
end if
end repeat
end open
The second do shell script line may not be needed in this variation.
(21517)

Similar Messages

  • How to make button to format a HardDrive or USB, How to remove all files from folder, and How to delete a process in listbox with a textbox?

    Hello!
    Here's the question with explaniation: How can i format the USB or Drive by clicking a button what's meant for it?
    and the second question what's also in vb.net: How can i remove all files from folder ? 
     Here's the Look of program: *
    Using the PC button, it will delete the free space of the PC, do you guys/girls know where it's location?

    Example Code:
    Imports System.Runtime.InteropServices
    Imports System.IO
    Public Class Form1
    Dim CBoxDrives As New ComboBox
    WithEvents FButton As New Button
    <DllImport("shell32.dll")> _
    Private Shared Function SHFormatDrive(ByVal hwnd As IntPtr, ByVal drive As UInteger, _
    ByVal fmtID As UInteger, ByVal options As UInteger) As ULong
    End Function
    Private Enum SHFormatFlags As Integer
    SHFMT_ID_DEFAULT = &HFFFF
    SHFMT_OPT_FULL = &H1
    SHFMT_OPT_SYSONLY = &H2
    SHFMT_ERROR = &HFFFFFFFF
    SHFMT_CANCEL = &HFFFFFFFE
    SHFMT_NOFORMAT = &HFFFFFFD
    SHFD_FORMAT_FULL = 0 ' full format
    SHFD_FORMAT_QUICK = 1 ' quick format
    End Enum
    Private Sub FButton_Click_1(sender As System.Object, e As System.EventArgs) Handles FButton.Click
    If CBoxDrives.Text = "" Then
    MsgBox("No Drive Selected")
    Exit Sub
    End If
    Dim Iresult As ULong = SHFormatDrive(CType(Me.Handle.ToInt32, IntPtr), CUInt(Asc(CBoxDrives.Text.Substring(0, 1)) - Asc("A")), CUInt(SHFormatFlags.SHFMT_ID_DEFAULT), 1)
    End Sub
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    Me.Size = New Size(200, 100)
    With FButton
    .Size = New Size(50, 25)
    .Location = New Point(5, 5)
    .Text = "Format"
    End With
    Me.Controls.Add(FButton)
    With CBoxDrives
    .Size = New Size(50, 25)
    .Location = New Point(75, 5)
    .DropDownStyle = ComboBoxStyle.DropDown
    End With
    Me.Controls.Add(CBoxDrives)
    Dim DrivesFound As Integer = 0
    Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
    Dim d As DriveInfo
    For Each d In allDrives
    If ((d.DriveType = DriveType.Fixed) Or (d.DriveType = DriveType.Removable)) AndAlso Environment.GetEnvironmentVariable("SYSTEMROOT").StartsWith(d.Name) = False Then
    CBoxDrives.Items.Add(d.Name)
    DrivesFound += 1
    End If
    Next
    CBoxDrives.SelectedIndex = DrivesFound - 1
    End Sub
    End Class

  • Creating Folder and Accessing Files from Folders in mobile phone

    Hello Friends,
    I am doing my project where I need to create folders and accessing files from those folders in java enabled mobile phones.But I do not know the required tasks for this.Any type of help is highly appreciated.
    Greeting
    Saadi

    You have to get the classname of the Items you receive from getitems.
    There you have only to look for Folder.CLASS_NAME. Example:
    ifsFol sorted by names in ascending order (names of folders and files)
    String[] sort_attributes = {"NAME"};
    //sort will be ascending
    boolean [] sort_orders = {true};
    oracle.ifs.common.SortSpecification sort = new oracle.ifs.common.SortSpecification(sort_attributes, sort_orders);
    ifsFol.setSortSpecification(sort);
    PublicObject[] contents = ifsFol.getItems();
    System.out.println("Here are the names of the items in folder: ");
    for (int i=0; i < contents.length; i++) {
    if (contents.getClassname().equals(Folder.CLASS_NAME)) {
    System.out.println(contents[i].getName());
    null

  • I want to have two folders of Finder so that I can easily drag and drop files from one folder to another

    I have been trying to reorganize my files. When in Manila I created a folder called Manila 2015 in Documents. I have the Mother folder Files 2015 with several subfolders like Finances, Personal, Tax etc. I want to have two finder folders simultaneously so that I can drag and drop files from the Manila 2015 folder to the various subfolders in the mother folder Files 2015. I am not able to open two windows of Finder on the desktop.

    I have since found out that a new finder window can be opened witht the short cut Command+N.
    Thanks anyway.

  • EPS-file: How to preserve resource fork when moving file to Linux

    Hi!
    We have a following problem on our DAM system:
    When saving an EPS-file from Photoshop CS2 on 10.4 with Machintosh preview we can´t transfer the file to Linux DAM system without losing the preview picture. Apparently this is because the PICT preview file is in resource fork of the file and Linux doesn´t understand anything about those.
    The problem occurs only with Freehand MX when using these un-"resource forked" files. Then using EPS with TIFF-preview we get a black background if cut path is used in the image so that´s not a proper solution.
    Can ANYONE point me a possible solution: how can I transfer Macintosh files on Linux without losing resource forks??
      Mac OS X (10.4.8)  

    Control-click on the file and choose the Create
    Archive of "blah" item in the menu that pops up.
    This creates a file called "blah.zip", which has
    been compressed in such a way that it can be safely
    stored on non-Mac systems. When it is de-archived
    on another Mac OS X system (by double-clicking it),
    the file should be intact. (Note that third-party
    apps for decoding zip files may not properly restore
    the resource fork, as the Mac's archive function
    creates a zip archive with the resource contents
    stored in a special way, which other unzip utilities
    will just read as another file (or folder, don't
    recall which).
    Thanks but I should have been more precise:
    What I meant was that is there any tool for Linux to handle resource forks without archiving/compressing the file?
    Our DAM generates preview image for the EPS automatically so it can´t be inside compressed file.

  • Delete file from folder only (not from list)

    Hi all,
    I've searched a lot and didn't succeed so far, that's why I need your help. In a cloud context, I'm actually creating and uploading files (pdf and/or xml files) "on the go" to sharepoint folders via the SOAP API and this is perfectly working. But
    in a cloud context, I also need to decomission services which is translated into deleting files into Sharepoint.
    That's where it became complicated, because according to the API we cannot delete files if they are not part of a list structure, which is not my case. Is that true ?
    The only info I have when trying to delete a file via the SOAP Api is : its name, its folder, and the endpoint where the folder is. So my question remains simple I guess : is this possible ? If so, how to (a link to the SOAP body would be usefull)
    Thanks a lot
    Regards
    Baptiste

    Hi,
    According to your post, my understanding is that you want to delete file from folder.
    In SharePoint 2010, It is recommended to use Client Object Model to achieve it, the following code snippet for your reference:
    string siteURL = "http://siteurl";
    ClientContext context = new ClientContext(siteURL);
    //specific user
    NetworkCredential credentials = new NetworkCredential("username", "password", "domain");
    context.Credentials = credentials;
    Web web = context.Web;
    context.Load(web);
    context.ExecuteQuery();
    string relativeUrl =web.ServerRelativeUrl +"/DocumentLibraryName/FolderName/FileName";
    File file = web.GetFileByServerRelativeUrl(relativeUrl);
    context.Load(file);
    file.DeleteObject();
    context.ExecuteQuery();
    If you still want to use SOAP API, we can use the UpdateListItems method under Lists web service to achieve it.
    http://www.dhirendrayadav.com/2010/06/delete-list-items-using-web-service.html
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/61466984-1844-48a1-8c1e-1c59a0f9876a/move-and-delete-files-remotely-using-sharepoint-web-services-?forum=sharepointdevelopmentlegacy
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

  • Print PDF file from folder using SSIS

    Is there a way in SSIS to print pdf file from folder?
    ANy help much appreciated.

    One method is calling Adobe Acrobat Reader exe from Execute Process Task within SSIS passing the document path as the argument
    The command and arguments will look like this
    http://geekswithblogs.net/JeremyRamos/archive/2013/10/22/print-ssrs-report--pdf-from-sql-server-agent-or.aspx
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Read contineously file from folder

    HI
    I have 1000 of files and I want read files from folder automatic. Each file ends with
    if $BATCH_FILE==true
    define $END,false
    else
    power off
    define $END,true
    if 1 text file is finish then it should load another file automatically

    Hi kalu,
    don't know what you're trying to do:
    - you have a "path" control but you don't use it for ListFolder...
    - you get an array of filenames from ListFolder, but you don't use that data later on...
    - you are using "OpenFile"/CloseFile to get a file path (in the event) and later on you use that path to read data from...
    Your original question doesn't has anything in common with those things you do now...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Reading files from folder in java

    Hi ..I am new to java ..can you help me ..how to read the files from folder(containing 10 java files) and store in a array..
    Thanks

    use the java.io package, more specifically java.io.File. You can construct a new File by passing in a String version of the pathname, and then store that into your array.

  • Protecting EXE, PDF and SWF files from piracy

    I am hoping others in the community have some experience with protecting their Captivate output (EXE and SWF files) from piracy.  We will be selling our eLearning products developed with Captivate through our online store and want to protect them against file sharing and other forms of piracy.  I have found several companies online offering DRM (digital rights management) and SAS (software activation services) that require users to enter a license key to use the products.  I am looking for any recommendations from users who have implemented these types of services.  What provider did you use and what issues did you encounter.  Any insights would be greatly appreciated!
    Thanks,
    Jason

    Most of the tools I have seen are geared towards extracting
    resources from swf's. I use one myself (eltima.com) for
    "harvesting" manufacturers content for my motorcycle dealers. They
    are authorized to use this content, but finding someone at Yamaha
    of Kawasaki or any of the majors who even knows where to find these
    resources is next to impossible. I have also used it to learn from
    by viewing scripts, but as you say, at the end of the day, I think
    the concepts and best practices are about the only thing worth
    taking away from others efforts, not the code.
    Unlocking a protected file can be done as well and I remember
    using a product over a year ago to get at the scripts within an swf
    (I wanted the URL's that pointed to media - it was legal for me to
    do this). It ran from the command line and output the scripts.
    There aren't too many of these types of programs to be found, but
    they exist.
    My personal opinion is that it's not worth the effort. My
    java classes can be decompiled and if someone wants to go to that
    trouble, more power to them. To my knowledge, there isn't anything
    out there yet that is perfect for backwards engineering an swf into
    an MXML file, but a competitor of FLASH Decompiler says that they
    can decompile Adobe 9 PLAYER swf's. For what it's worth, I plan on
    posting the majority of my code on my flexdev.org site once I get
    it established.
    For people who make components for sale, this could be an
    issue of stolen revenue if the decompilers get sophisticated enough
    to reverse engineer the swc into a usable MXML file. I would be
    against anyone who stole code for this purpose, for sure.

  • How to Purge pdf and xls files from $LOG_HOME

    Hi There,
    application: ebs R12(12.1.2)
    db: 11.1.0.7
    OS: linux5(x86-64)
    can any one let me is there any concurrent program through this i can purge lots of pdf and xls files from $LOG_HOME/ora/10.1.2/reports/cache folder.
    Please help me out in this regards,
    Thanks in Advance.
    Regards,
    Mohsin
    Edited by: 920138 on May 12, 2012 4:12 AM

    Please also see:
    Patch 11669923 Post Patch Instructions Would Get Overridden By Autoconfig [ID 1322704.1]
    REP-56093: File : Cached Output For Job 1 is No Longer Valid [ID 1321342.1]
    Rep-57054: In-Process Job Terminated:Finished Successfully But Output Is Voided [ID 1332176.1]
    Thanks,
    Hussein

  • My macbook pro with OS x Lion will not drag and drop files from finder or iTunes

    My macbook pro with OS x Lion will not drag and drop files from finder or iTunes. Can anyone help?

    Hi, I just have same problem.. I can't drag and drop file /folder.. please help.. I can drag the file/folder and move it , but I can't drop it after move it please help...!!!
    It is happen just after I re-start my computer.. I tried to repair and anything but just don't work. Actually the old style one finger double tab and lock is much better rather the 3 fingers.
    Please help to fix the drag and drop for file/folder/itunes.

  • I want to transfer my photo and movie files from my iPhone 4S to my mac.

    I have posted this question before without any success and was hoping by reposting it may promt a solution to my problem.
    I want to transfer my photo and movie files from my iPhone to my Mac OS X (10.5.8).
    But I don't want to use Cloud or iTunes.
    Is there a way to connect my iPhone 4S to my Mac directly,
    say ... via a program or such on my MAC, to drag and drop the photos and Movie files,
    directly into a folder. ??????????
    Reason want to connect iPone to MAC or MAC to iPhone is ....
    I have no DATA on my iPhone Mobile plan at moment.
    So Photosync app is no good, as I can't download the app to my iPhone.
    I can download a Photosync to my MAC ...
    but with the Photosync app you can only send data.
    Thanks in advance for any help.

    Sorry I should of mentioned ....
    Reason want to connect iPone to MAC or MAC to iPhone is ....
    I have no DATA on my iPhone plan at moment.
    So Photosync app is no good, as I can't download the app to my iPhone.
    I can download a Photosync to my MAC ...
    but with the Photosync app you can only send data  (so needs to be on the  iPhone).

  • Hi,delete file from folder?

    hi,i am deleting file from folder as follwos
    <%@ page import="java.io.File" %>
    <%
    File myFile = new File("D:\\jakarta-tomcat-4.1.18\\webapps\\ROOT\\upload_files\\xyz.txt");
    myFile.delete();
    %>
    i am sucessfuly deleted file from above path.
    if i use follwing code i unable to delete my file, can one help,
    how to do it,
    <%@ page import="java.io.File" %>
    <%
    String fname="xyz.txt";
    File myFile = new File("D:\\jakarta-tomcat-4.1.18\\webapps\\ROOT\\upload_files\\'"+fname+"'");
    myFile.delete();
    %>
    thanks
    pullareddy

    i think if above doesn't work try this it should work
    change this line
    File myFile = new File("D:\\jakarta-tomcat-4.1.18\\webapps\\ROOT\\upload_files\\'"+fname+"'");
    to this
    File myFile = new File("D:\\jakarta-tomcat-4.1.18\\webapps\\ROOT\\upload_files\\"+fname);

  • Uploading and downloading files from a web app (Urgent!!)

    Hi everyone:
    I'm developing an application in PL/SQL to upload and download files from an HTML webpage. I congured the document table and the parameters necessary in the DAD of my application.
    when I upload the file using my webpage that file info is automatically uploaded to the doc table. This is as far as I have gotten.
    I need to do the following:
    - Place the uploaded file into a column in another table in my database as part of a text message (think of it as an email message), and delete the file from the doc table (as this is thought to be a temp table that holds the file when uploaded from my webpage)
    - Retreive the file so that it can be downloaded from another web page.
    The file can be a PDF, WORD DOC, etc...
    I now that I can do this with InterMedia but I haven't figured out how :(
    Can anyone please point me to an example or some documentation that can guide me through the process.
    DB VERSION: 8.1.7
    IAS VERSION: 1.0.2.2
    Thanks,
    Carlos Abarca

    The idea was for you to look at the code and get an idea of how to access the BLOB in the document table. IF you look at the procedure
    insert_new_photo( new_description IN VARCHAR2,
    new_location IN VARCHAR,
    new_photo IN VARCHAR2 )
    It shows how to access the blob that is stored in the document table. You can then copy this blob to your own table using the DBMS_LOB package.
    Hope this helps,
    Larry

Maybe you are looking for

  • Error in updating BO record

    Hi all,        I am trying to update one of the attribute of BO record by calling update function of BO in an application service. But i am getting an error message " Entity is locked by user guest". I have written following code. // getting service

  • How to index DancePack clips (or my own loops) into STPro?

    How do I get STPro to index Dancepack clips (and my own clips) so that they show up in a search for clips? I put them in the clips in HD/Library/Audio/Apple Loops/Apple folder, along with the "Jam Pack World Music" which is indexed by STPro.

  • Arch does not show up in Grub when dual booting with windows 8

    I just installed Arch linux, dual booting with windows 8 using the beginners guide[https://wiki.archlinux.org/index.php/Beginners'_Guide] itself. Now Grub is installed and i can only find Windows 8 and I cannot find Arch. Is there a way I can find if

  • Arrear days and deduction days in a hr report

    Dear Abapers i have to generate a monthly report in HR .requirement is i hve to clucluate his arrears days and deduction days.suppose an employ has not come in 29th of the current month in his pay he is considered as present and gets paid for it as p

  • Help with regions

    hi all. i have 3 html regions on page. i used 1st region to place some drop down combos. next 2 regions are for reports depending on the values of the combos. now the problem is layout. i have set column value for combo region as 1. for first report