[python] Copy script to generate copy log

The GUI version is ready. inon3135/CopyWithLog

I want to list the copy destination and copy source!

When visualizing data in posters and papers, the image file to be pasted is I want to keep it together with the document file. But while looking at the file, ** "Which of this data?" ** is Zara. So when you copy a file, the copy source and copy destination are generated as log files in each folder. I wrote a copy script.

From here https://codebreak.com/git/nozomu/CopyWithLog-python/tree/master/

How to use

copy.py


Usage:
    copy.py [--symbol] -s <source> -o <mirror>
    copy.py [--symbol] -o <mirror> -s <source>
    copy.py -h | --help
    copy.py --version

Options:
    -h -help    Show this screen.
    -version    Show version.
    --symbol    Make mirror file as symboli link file.
    -s          Set source file
    -o          Set mirrored file (or directory)
    $ copy.py --symbol -s a.png -o $POSTER/fig1.png

You need to add the directory containing copy.py to $ PATH or write the path.

Copy a.png to $ POSTER / fig1.png and generate (or add) a log file for each. With the --symbol option, the copy file will be generated as a symbolic link.

~, Environment variables (\ $ name, \ $ {name}) are available. If the file name is not specified in \ <mirror > (copy destination) and the directory path is used, A file with the same name as \ <source > will be generated [^ 2].

[^ 2]: If you specify a directory path, it must be closed with a'/' at the end.

log file format = Markdown [^ 1]

logfile: mirror-log.md logfile: source-log.md

[source-log.md]: maked on mirror directory

  File name | source-path | copied date
     ---    |     ---     |     ---
 filename |   path    |   date

[mirror-log.md]: maked on source directory

  File name | mirror-file-path | copied date
     ---    |       ---        |     ---
 filename |      path      |   date

Generate files mirror-log.md and source-log.md in the copy source and copy destination, respectively. If there are multiple copies, the log will be added. The logs are basically sorted by file name abc (case insensitive).

Basically the copy will be overwritten without warning. Also, even if the same copy source and copy destination are processed multiple times, all the history remains in the log. (File updates are not detected.)

[^ 1]: If there is a Markdown symbol in the directory path, it will look bad, so I may change it.


Function that may be expanded

You may need the ability to manage log files. Currently, even if there is a log file that is meaningless due to the loss of the file It can only be erased manually. That might be a little troublesome.

Good reason

The source is terrible because I wrote it properly.

Recommended Posts

[python] Copy script to generate copy log
python log
Add TRACE log level to Python ...?
[Good By Excel] python script to generate sql to convert csv to table
Script to generate directory from json file
Pin current directory to script directory in Python
Sample script to trap signals in Python
Output Python log to console with GAE
Log in to Slack using requests in Python
Module to generate word N-gram in Python
How to run a Maya Python script
Script python file
Updated to Python 2.7.9
python script skeleton
Python script profiling
Import python script
Copy of python
Log monitoring script
"Backport" to python 2
[Introduction to Udemy Python 3 + Application] 26. Copy of dictionary
Library comparison summary to generate PDF with Python
Python script to convert latitude / longitude to mesh code
[Introduction to Udemy Python 3 + Application] 19. Copy of list
How to generate a Python object from JSON
Try to automatically generate Python documents with Sphinx
Log in to Yahoo Business with Selenium Python
Output python log to both console and file
[Improved version] Script to monitor CPU with Python
[CentOS8] How to output Python standard output to systemd log
Python script to get note information with REAPER
How to add help to HDA (with Python script bonus)
I want to generate a UUID quickly (memorandum) ~ Python ~
Changes from Python 3.0 to Python 3.5
Copy of python preferences
How to install python
python decorator to retry
Introduction to Python language
A memorandum to run a python script in a bat file
Introduction to OpenCV (python)-(2)
Preparing to script control Rhino objects in Grasshopper / Python
DynamoDB Script Memo (Python)
[Python3] I want to generate harassment names from Japanese!
Note to daemonize python
I tried to automatically generate a password with Python3
Introducing Python 2.7 to CentOS 6.6
Copy S3 files from Python to GCS using GSUtil
Connect python to mysql
[Python MinMaxScaler] Normalize to 0 ~ 1
Python script to create a JSON file from a CSV file
Generate a bash script to add Datadog monitor settings
Script to count and stop up to 5 seconds in Python in Blender
Assigned scaffolding macro in Python script file to F12 key
A Python script that saves a clipboard (GTK) image to a file.
How to run a Python program from within a shell script
[Linux] Copy data from Linux to Windows with a shell script
How to generate exponential pulse time series data in python
Challenge problem 5 with Python: lambda ... I decided to copy without
[For beginners] Script within 10 lines (4. Connection from python to sqlite3)
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
[GCP] How to output Cloud Functions log to Cloud Logging (Stackdriver Logging) (Python)
A python script that converts Oracle Database data to csv