With the jfrog-cli I want to copy "tags/$version" to "released/$version"
$version has subdirectories that I need to keep in the respective format.
I tried :
jfrog rt cp --flat=false repo/tags/$version/* repo/released/
What I get is :
repo/released/tags/$version
Can anyone help?
Artifactory cp/mv is BIZARRE... it does not work like a regular file system move or copy command.
The following moves (within the same repository) everything including subfolders from test/example/libraries/1.0.0 to test/example/libraries/2.0.0 .
jfrog rt mv release-local/test/example/libraries/1.0.0 release-local/2.0.0 --user ${userid} --password ${userpwd} --url https://artifactory
Before
/test
/example
/libraries
/1.0.0
file1.dll
/folder1
file2.dll
After
/test
/example
/libraries
/2.0.0
file1.dll
/folder1
file2.dll
The command appears to take the last element of the path of the target and replace it with the entire path of the source repository less the last element of the path... basically it is like a file rename that includes the path as part of the rename. Note that you do not have to use the recursive flag or the flat flag for it.
In the latest release of JFrog CLI (version 1.23.1) the command to copy files from one repository to another should be similar to what you have.
For example, if I want to copy all versions from a repository libs-snapshot-local/ and path org/jfrog/test/ to a repository called generic-local I can execute the command
jfrog rt cp libs-snapshot-local/org/jfrog/test/ generic-local/
By default, it will recursively copy all items of libs-snapshot-local/org/jfrog/test/ to their new location in generic-local
Related
How do I use winzip command line with include full path information ? I know I can do this under Winzip GUI but how to do it using cmd ? Also, is there a way to zip selected specific folders only ? Thanks
Tried GUI and it is working very slow
Winzip command line doesnt seem to zip selected folders - either parent folders or specific subfolders
I am using winzip 27 command line and this is the syntax I am using:
wzzip -a -e0 -k -P -r -yx "C:\Users\source\to\save\zipfile.zip" "C:\example"
This stores files and folder timestamps underneath C:\example. But since I have enabled -P -r, I want to store the timestamps of the upper folder, C:\example folder. How can I do that ? Does anyone have suggestions?
Also, how do I specify the path for a mapped network drive? Thanks!
I'm new to automation and Tried uploading entire folder structure to Artifactory repo with parent folder and child folders
structure is as below
test1 folder contains sub-folder: new_ref and it also contains sub-folder>>v1, new_data1 and it also contains sub-folder>>v1, v1 and it also contains sub-folder>>bl, memo
Tried using both --flat=true and false option:
jfrog.exe rt u --flat=false "F:/main/test1/" mr-local-generic/new_data/
On Artifactory its required to create folder name "new_data" and under that it should upload below folders with their respective child folders intact: new_ref, new_data1, v1, memo
But it creates folder name as new_data/F:/main/test1/ , how to resolve this any help is much appreciated.
--flat=false keeps the system hierarchy. If you wish to upload without the path prefix, you have the following options:
Run the upload command from the directory you wish to upload from, and use relative path with --flat=false:
cd /d F:\main\test1
jfrog.exe rt u --flat=false "./" mr-local-generic/new_data/
Use Placeholders:
jfrog.exe rt u "F:/main/test1/(*)" mr-local-generic/new_data/{1}
To apply the source path pattern for directories as well as files, add the include-dirs flag.
For example:
jfrog.exe rt u --include-dirs=true "F:/main/test1/(*)" mr-local-generic/new_data/{1}
I have a directory that contains media that I am trying to setup a basic symbolic link to - the directory is a mounted storage on a digital ocean droplet in the following directory /mnt/storage/media/all
this contains directories as shown below:
0118
0119
0218 and so on.......
I am trying to make a symlink from my unix terminal as follows :
$ root#server1:/var/www/abcd/public ln -s /mnt/storage/media/all
So if I cd into the public directory above I would expect to see the directories 0118, 0119, 0218 and so on... however when I cd into this directory I see the directory all and within this directories are the 0118, 0119, 0218 subdirectories.
How do I change the symbolic link so I see the directories 0118, 0119, 0218 etc.. and not the all directory (which contains those same sub directories)
Try giving a second argument for the function. Let that argument be the desired destination for the link (but it shouldn't exist prior to this).
E.g. ln -s /mnt/storage/media/all /var/www/abcd/public
In case the folder public already exists, the symlink will be created inside it.
How does one add a new directory within a subdirectory using a CVS repository?
cvs add [new_dir_name]
simply creates a new directory on the first level of the repository, while going into the subdirecory I am interested in and adding does not work. i.e.L
cd repository/directory
cvs add [new_dir_name]
Produces an error:
cvs [add aborted]: there is no version here; do 'cvs checkout' first
(This error message, though, still happens when I check out the repository).
Any ideas how to do this?
cd repository
mkdir a
mkdir a/b
mdkdir a/b/c
cvs update -d a/b/c ( not sure if in one go works, if not, try one after another)
The option -d will create directories that are missing. The same should work for add, if you cvs update afterwards and commit to persist it.
Personally I would use git or svn - changed from cvs ~10y ago
You must add each directory in the path to the final subdirectory that is not present on the server in descending oder.
For example...
If you are in the root of your cvs repository, the following should work.
mkdir -p dirname/subdirname
cvs add dirname
cvs add dirname/subdirname
alternately / equivalently
mkdir -p dirname/subdirname
cvs add dirname
cd dirname
cvs add subdirname
I am having trouble symlinking dotfiles. I have a folder in my home directory ~/dotfiles which I have synced to a github repo. I am trying to take my .vimrc file in ~/dotfiles/.vimrc and create a symbolic link to put it at ~/.vimrc. To do this I type in
ln -s ~/dotfiles/.vimrc ~/.vimrc
But when I run that it says
ln: /Users/me/.vimrc: File exists
What am I doing wrong?
That error message means that you already have a file at ~/.vimrc, which ln is refusing to overwrite. Either delete the ~/.vimrc and run ln again or let ln delete it for you by passing the -f option:
ln -s -f ~/dotfiles/.vimrc ~/.vimrc
There is a better solution for managing dotfiles without using symlinks or any other tool, just a git repo initialized with --bare.
A bare repository is special in a way that they omit working directory, so you can create your repo anywhere and set the --work-tree=$HOME then you don't need to do any work to maintain it.
Approach
first thing to do is, create a bare repo
git init --bare $HOME/.dotfiles
To use this bare repo, you need to specify --git-dir=$HOME/.dotfiles/ and --work-tree=$HOME, better is to create an alias
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME
At this point, all your configuration files are being tracked, and you can easily use the newly registered dotfiles command to manage the repository, ex :-
# to check the status of the tracked and untracked files
dotfiles status
# to add a file
dotfiles commit .tmux.conf -m ".tmux.conf added"
# push new files or changes to the github
dotfiles push origin main
I also use this way to sync and store my dotfiles, see my dotfiles repository and can read at Storing dotfiles with Git where I wrote about managing for multiple devices.
How to symlink all dotfiles in a directory recursively
Have a dotfiles directory that is structured as to how they should be structured at $HOME
dotfiles_home=~/dotfiles/home # for example
cp -rsf "$dotfiles_home"/. ~
-r: Recursive, create the necessary directory for each file
-s: Create symlinks instead of copying
-f: Overwrite existing files (previously created symlinks, default .bashrc, etc)
/.: Make sure cp "copy" the contents of home instead of the home directory itself.
Tips
Just like ln, if you want no headache or drama, use an absolute path for the first argument like the example above.
Note
This only works with GNU cp (preinstalled in Ubuntu), not POSIX cp. Check your man cp, you can install GNU coreutils if needed.
Thanks
To this and this.