1

Say I want to run a program or transfer files over the network using scp, and I create a screen and run those commands in the screen using * to indicate that I want the command to apply to all files in that folder. Does the command only work on the files present at the time when the command was executed, or will it work on files that I later move/copy into the same folder after I have executed the command?

2

2 Answers 2

5

I guess he creates a screen session and fires off a long running command like scp or ftp a bunch of files in a folder. While that upload or download is running he adds more files to the source folder/server.

Bash (the shell you are probably running your command with) will only execute the command only on those files that are present at the time of executing the command, because the * character is regarded as a pattern and replaced by the file names matching that pattern.

See man bash

Pathname Expansion

After word splitting, unless the -f option has been set, bash scans each word for the characters *, ?, and [. If one of these characters appears, then the word is regarded as a pattern, and replaced with an alphabetically sorted list of file names matching the pattern.

3

I dont know what you mean by creating a screen either, but it will only be applied to the files present at the time you execute the command.

1
  • Thanks! By "screen", I meant Linux's screen for remote session management.
    – Rayne
    Jul 9, 2013 at 3:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .