Re: vim | multiple files editing and delete question (bash script)

2006-09-14 Thread Yakov Lerner

On 9/14/06, Nikolaos A. Patsopoulos [EMAIL PROTECTED] wrote:

Yakov Lerner wrote:
 On 9/14/06, Nikolaos A. Patsopoulos [EMAIL PROTECTED] wrote:
 3. This is not Vim related but I wonder if anyone knows sth. I have
 the following structure of folders and files:

 ..
 folder1
 file1
 file2
 folder2
 file1
 file2
 .


 and want to add the folder name into the filename:
 ||

 folder1
 ||folder1|_|file1
 ||folder1|_|||file2
 folder2
 ||folder2|_|||file1
 ||folder2|_|||file2

 Try this shell script:

  for file in folder*/*; do
  dir=$(basename $(dirname $file) )
  base=$(basename $file)
  mv $file $(dirname $file)/${dir}_${base}
  done

 Untested!

 Yakov



Bash result: script started, file is typescript.

Nothing happens. Just an empty file called typescript appears in parent
folder.


Try on bash mailing list or bash irc chan.

Yakov


Re: vim | multiple files editing and delete question (bash script)

2006-09-14 Thread Nikolaos A. Patsopoulos

Yakov Lerner wrote:

On 9/14/06, Nikolaos A. Patsopoulos [EMAIL PROTECTED] wrote:

Yakov Lerner wrote:
 On 9/14/06, Nikolaos A. Patsopoulos [EMAIL PROTECTED] wrote:
 3. This is not Vim related but I wonder if anyone knows sth. I have
 the following structure of folders and files:

 ..
 folder1
 file1
 file2
 folder2
 file1
 file2
 .


 and want to add the folder name into the filename:
 ||

 folder1
 ||folder1|_|file1
 ||folder1|_|||file2
 folder2
 ||folder2|_|||file1
 ||folder2|_|||file2

 Try this shell script:

  for file in folder*/*; do
  dir=$(basename $(dirname $file) )
  base=$(basename $file)
  mv $file $(dirname $file)/${dir}_${base}
  done

 Untested!

 Yakov



Bash result: script started, file is typescript.

Nothing happens. Just an empty file called typescript appears in parent
folder.


Try on bash mailing list or bash irc chan.

Yakov



Thanks. I'll do that.
Nikos