When I compile a specific folder in mac, I get a renamed file to add and delete files in the folder

I am tracking a specific folder in mac os by providing a command line

fswatch -x /Users/syammala/folder 

/Users/syammala/folder/posixGroup.xml Renamed IsFile

Whenever I add or delete a file, I always get the renamed file. I want to distinguish an action when adding and deleting files

+4
source share
1 answer

Updated Answer

As you now find out that you move and delete files with Finder, this makes life difficult because when you use Finder, it interacts with Trashcan, unlike when you use Terminal and Unix commands. So, when you delete a file in Finder, it renames the file to Trashcan, which is stored in $HOME/.Trash .

So, you really need to track Trashcan, and also wherever you plan to track:

 fswatch -x FolderA $HOME/.Trash 

then you will see everything that happens.

Alternatively, disable Trashcan, which in my opinion may not be acceptable, but you do not provide details about your environment, so I don’t know.

To disable Trashcan, delete the $HOME/.Trash and all its contents, and then create a file called $HOME/.Trash so that OSX cannot recreate your favorite Trashcan. Do not do this if you do not understand it!

 cd rm -rf .Trash touch .Trash 

To enable Trashcan later, do the following:

 cd rm .Trash 

Original answer

You can do this with numerical flags.

If you do this:

 touch FreddyFrog rm FreddyFrog touch BozoBrains mv BozoBrains SillyBilly rm SillyBilly 

you can follow this

 fswatch -xn `pwd` /Users/mark/tmp/FreddyFrog 514 # touch FreddyFrog /Users/mark/tmp/FreddyFrog 520 # rm FreddyFrog /Users/mark/tmp/BozoBrains 514 # touch BozoBrains /Users/mark/tmp/BozoBrains 528 # mv BozoBrains SillyBilly /Users/mark/tmp/SillyBilly 528 # mv BozoBrains SillyBilly /Users/mark/tmp/SillyBilly 520 # rm SillyBilly 
+3
source

All Articles