Folderwatch deepanalyse5/3/2023 Into: with open(path "/.time_data.txt", "a") as out:įrom your comments, and the discussion in chat, I understand that you are actually looking for a tool to log access to a folder (e.g. If you want that, change: with open(path "/time_data.txt", "a") as out: Place a dot before the filename to make it a hidden file (press Ctrl H to toggle visability): Use it just like the first option (but obviously you don't need to set the command).Out.write("the folder " foldername " was opened " time.ctime() "\n") With open(path "/time_data.txt", "a") as out: #- the path your file is saved to (change if you want to, but use full paths) The script below creates a file in your $HOME directory with the time your folder was accessed.: #!/usr/bin/env python3 You can however make it work "all-in-one", so you do not need another script. Test = subprocess.check_output().decode("utf-8") #- replace "" with your command (between quotes): Change in the head section of the script "" by your command (between quotes).In the example below, the script runs a command when a folder is accessed for the first time, and exits. You'd have wmctrl to be installed: sudo apt-get install wmctrl The loop to check would however take at least a split second to notice the folder is opened. You can get the window list from the command wmctrl -l, and see if the folder's name occurs in the list. nautilus, not the time it takes to access the folder. I assume you need to know the (clock-) time the folder is opened in e.g.
0 Comments
Leave a Reply. |