Skip to content

LoliMizuki/path2pathAction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

path2pathAction

ver.20131212

Batch make symbolic links or copy depneded on define in json file. developed by Go.

usage: path2pathAction [-sl|-c] <file_path>

Json Format

    {
        "case_name": {
            "path_type": "[absolute|abs|a | relative|rel|r]",
            "src_path_parent": "source_path_parent",
            "src_path_children": ["source_child_#1", "source_child_#2", ...],
            "dest_path": "destination_path"
        },
        
        .
        .
        .
        (other cases)
    }
  • case_name: mark this case, you can define many cases in one json file.
  • src_path: define action source. use two layers, so you can make link or copy from many source to destination path.
  • dest_path: destination path.

Example

Consider json content as below, and locate at path /User/MyComputer/Files/PathsPairTest.json:

    {
        "Case1": {
            "path_type": "absolute",
            "src_path_parent": "/User/MyComputer/SourceFiles",
            "src_path_children": ["file1.f", "imgae1.png", "folder/fileInFolder.txt"],
            "dest_path": "/User/MyComputer/DestinationFiles"
        },
        
        "Case2": {
            "path_type": "rel",
            "src_path_parent": "SourceFiles",
            "src_path_children": ["file1.f", "imgae1.png", "folder/fileInFolder.txt"],
            "dest_path": "DestinationFiles"
        }
    }

and source in Case1 is:

User/MyComputer/SourceFiles/
                        |-file1.f
                        |-imgae1.png
                        |- folder/
                            |-fileInFolder.txt 

in Case2:

User/MyComputer/Files/
                        |-file1.f
                        |-imgae1.png
                        |- folder/
                            |-fileInFolder.txt 

use command $ path2pathAction -sl /User/MyComputer/Files/Test.json then Case1 would make symbolic links of "file1.f", "imgae1.png" and "fileInFolder.txt" to "/User/MyComputer/DestinationFiles" like below:

User/MyComputer/DestinationFiles/SourceFiles
                                    |-file1.f
                                    |-imgae1.png
                                    |- folder/
                                            |-fileInFolder.txt

and Case2 do the same action but in json file's relative position:

User/MyComputer/Files/DestinationFiles/
                                    |-file1.f
                                    |-imgae1.png
                                    |-fileInFolder.txt                                

(attention "fileInFolder.txt" not include it's folder)

Future Works

  • Add unit test.

About

batch make symolic links by json format file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published