cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

How to use resync command to get a version of all files with a specific extension?

jerazo
1-Newbie

How to use resync command to get a version of all files with a specific extension?

In the process of creating a Sandbox with several levels of directories and with many files, sometimes I'll need to update all files in it with a .docx extension or .csv extensions to a specific version or latest checked in. I've had no luck so far, as the resync for some reason is not recursing down directory levels. I've tried stuff like this:

si resync --revision=:head --recurse --sandbox="/home/ls897/perl/head_foot/sbx/design/code/project.pj" "/home/ls897/perl/head_foot/sbx/design/code/*.doc"

With this response: The file *.doc is not a current or destined or former or pending member or a subsandbox.

si resync --revision=:head --recurse --sandbox="/home/ls897/perl/head_foot/sbx/design/code/project.pj" "*.doc"

With this response: *** MKS125335: Out of tree members and subprojects (not located in the project directory or a subdirectory of the project directory) are not supported.

1 ACCEPTED SOLUTION

Accepted Solutions
jerazo
1-Newbie
(To:mrump)

Ok, I figured out how to make it do what I wanted it to do. Your replies helped! Thanks.

Here's how the command worked for me:

si resync --revision=:head --recurse --overwriteUnchanged --filter=file:"*.c" --sandbox="/home/perl/build_scripts/sbx/project.pj"

This downloaded and/or overwrote the file with head revision for ".c" files only into the local directory.

View solution in original post

6 REPLIES 6
mrump
14-Alexandrite
(To:jerazo)

Hi Juan,

on the GUI you can choose F11 (select member) in your Sandbox. The upcomming dialog offers you the chance to enter a name filter like *.docx

alternatively  the CLI offers a --filter option for the resync command.

Please see the manual for details

        --filter=attribute:name=*.docx

jerazo
1-Newbie
(To:mrump)

Matthias,

I'm in need of scripting this with CLI. The filter doesn't seem to help me, since I don't want to remove the files, but instead I want to request a specific version of all .doc files. If you see in the commands I've provided, there I'm requesting the head revision. Unfortunately that command is not working if for all levels of directories in the sandbox, only for the one specified in the last argument, and if it doesn't find any in that directory it just says it hasn't found a match.

MichaelChatel
20-Turquoise
(To:jerazo)

Juan,

Are you looking at creating a scoped sandbox?  You can specify file types that you want to pull into the sandbox, members with certain labels/revisions, etc.  If so, you can check the user guide, for the "Creating Sandboxes" section, and we go into "specifying the sandbox scope".  If I understand your inquiry correctly.

tdalon
4-Participant
(To:jerazo)

Hi Juan

Just to be sure I understood well:

si resync --revision:head --filter=file:*.docx -R --sandbox="C:/ls897/perl/head_foot/sbx/design/code/project.pj"

does not work because the filter only applies in the root sandbox directory?

This would be weird. I would report a bug to PTC.

mrump
14-Alexandrite
(To:jerazo)

Hi Juan,

lets may some things clear:

The command

"si resync --revision=:head --recurse --sandbox="/home/ls897/perl/head_foot/sbx/design/code/project.pj" "*.doc""

cannot work, as "si resync" does the following

- in case the working revision in side your sandbox is not the member revision on the server, it will download the member revision from the server (no matter if it is the head or not)

---

Assuming you already have a sandbox (aka "working area") you can selectively "download" any revision of a file using the "si co" (check out) command

e.g.

si co --revision=:head --recurse --nolock --filter=attribute:name=*.doc --sandbox="/home/ls897/perl/head_foot/sbx/design/code/project.pj"

will do the following.

- walk through your sandbox recursively

- download the head revision of any *.doc member it finds to your sandbox


Note:

This will only work for members that are already inside your sandbox. A new member that was added to the server would not be found in the sandbox and therefore not be found be the recursive checkout.

To handle this you will have to use

si resync --filter=changed:newmem --sandbox="/home/ls897/perl/head_foot/sbx/design/code/project.pj

or more general

si resync --filter=changed:missing --sandbox="/home/ls897/perl/head_foot/sbx/design/code/project.pj"


before you use the checkout operation above.


depending on your usecase a scoped sandbox would be something to think about (see the post aboveMichael Chatel)

jerazo
1-Newbie
(To:mrump)

Ok, I figured out how to make it do what I wanted it to do. Your replies helped! Thanks.

Here's how the command worked for me:

si resync --revision=:head --recurse --overwriteUnchanged --filter=file:"*.c" --sandbox="/home/perl/build_scripts/sbx/project.pj"

This downloaded and/or overwrote the file with head revision for ".c" files only into the local directory.

Top Tags