Skip to content

CodingForFunAndProfit/touchx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

touchx

Creates/touches a file in folder. If folder/s do not exist they will be created first.

While learning Go I created many repositories and always had to create a folderstructure. For example: mkdir cmd mkdir server touch cmd/server/main.go

I could reduce it to: mkdir -p cmd/server touch cmd/server/main.go

or even in one line: mkdir -p cmd/server && touch cmd/server/main.go

To save a bit time and learn some more with go I wrote this program, so I can do the above with one line, like:

touchx cmd/server/main.go

cases to test:

  1. file does exist (./file, path/file, path/subpath/file) and every path -> exit
  2. else: file or path does not exist
    1. path(s) exists but not the file -> create file (subpath could not exist!)
    2. path(s) does not exist (and so does the file) -> create path(s) && file
  3. file exists as directory

About

Creates/touches a file in folder. If folder/s do not exist they will be created first.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages