Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7000845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:43:31+00:00 2026-05-27T20:43:31+00:00

In my TCL script I use rsync command and unfortunately it is refusing to

  • 0

In my TCL script I use rsync command and unfortunately it is refusing to sync path contain “*” character.

Code Example:

 set srs "/users/home/username/common/*"
 catch {exec  rsync -av $src /tmp} res
 puts $res

Output:

 building file list ... done

 sent 29 bytes  received 20 bytes  98.00 bytes/sec
 total size is 0  speedup is 0.00
 rsync: link_stat "/users/home/username/common/*" failed: No such file or directory (2)
 rsync error: some files could not be transferred (code 23) at main.c(977) [sender=2.6.9]
    while executing
  "exec  rsync -rLptgov  $src /tmp "
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:43:32+00:00Added an answer on May 27, 2026 at 8:43 pm

    The canonical way of writing that is:

    set srs "/users/home/username/common/*"
    catch {exec rsync -av {*}[glob $src] /tmp} res
    puts $res
    

    This is because Tcl doesn’t expand glob metacharacters by default; it’s safer that way and easier to write correct code (it’s hard to write good shell code that is resistant to problems in this area) but it does mean that you need to do a little extra work. The extra work is:

    1. Ask for glob expansion of $srs with the glob command. That returns a list.
    2. Ask for expansion of the list out of the glob by using the {*} pseudo-operator (it’s not an operator — it’s technically a kind of syntax — but it works a lot like one).

    If you’re using Tcl 8.4 (or before!) then you do it a bit different way:

    set srs "/users/home/username/common/*"
    catch {eval [list exec rsync -av] [glob $src] [list /tmp]} res
    puts $res
    

    OK, that’s sometimes often shortened by leaving out the list bits (and there are many more obscure ways of writing it!) but that’s a bad habit as it can cause huge problems when dealing with variables with values that aren’t “nice”, e.g., with spaces in pathnames. If you have 8.5 or later, use {*}. Really.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing a TCL script to match everything in between two key words Example: X509v3
Within my Tcl script I'm building source code in another language. Let it be
I read a tcl test script, it uses EXPECT. some of the code is:
Is there a way in TCL to enclose a piece of code in a
I'm looking to reimplement some Tcl code that uses the socket -server construct [1].
tclsh is a shell containing the TCL commands. The TCL uplevel command evaluates the
I have a tcl script which 'exec' rpmbuild. When doing so, the 'topdir' used
I wrote a script in tcl to grab links out of the download portion
i wrote a script for spawing the bc command package require Expect proc bc
When calling script as tclsh ./TestDriver.tcl TestList the tcl script stops after one (?)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.