Reply
Thread Tools
Posts: 486 | Thanked: 251 times | Joined on Oct 2009
#11
Originally Posted by RWFarley View Post
I have a subdirectory with a large number of files ranging from 0000.xyz to zzzz.xyz. I made two files named ~Index.txt and ~List.txt, but they sort into the middle insted of at the top.

What file name can I give these files to bring them to the top of the file listing?
Nothing like using the standard unix tools to do an experiment. This may depend on the locale. My n900 is the USA version. The results are different between the file manager and ls. Screenshot at bottom of post.

Also, some characters are not a good idea for file names, even it they work.

I wrote a short perl script collate.pl
Code:
#!/usr/bin/perl -w
for ($i=33; $i<127; $i++) {
  $fname = sprintf("\\%c%3.3d.txt", $i, $i);
  `touch $fname`;
}
To run:
Code:
~ $ cd /home/user/MyDocs
~/MyDocs $ mkdir collate
~/MyDocs $ cd collate
~/MyDocs/collate $ /home/user/bin/collate.pl 
touch: "034.txt: Invalid argument
touch: *042.txt: Invalid argument
touch: invalid option -- 0
BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso30+0m5) multi-call binary

Usage: touch [-c] FILE [FILE...]

touch: /047.txt: Permission denied
touch: :058.txt: Invalid argument
touch: <060.txt: Invalid argument
touch: >062.txt: Invalid argument
touch: ?063.txt: Invalid argument
touch: \092.txt: Invalid argument
touch: |124.txt: Invalid argument
~/MyDocs/collate $ ls
!033.txt  2050.txt  B066.txt  N078.txt  Z090.txt  g103.txt  s115.txt
#035.txt  3051.txt  C067.txt  O079.txt  [091.txt  h104.txt  t116.txt
$036.txt  4052.txt  D068.txt  P080.txt  ]093.txt  i105.txt  u117.txt
%037.txt  5053.txt  E069.txt  Q081.txt  ^094.txt  j106.txt  v118.txt
&038.txt  6054.txt  F070.txt  R082.txt  _095.txt  k107.txt  w119.txt
'039.txt  7055.txt  G071.txt  S083.txt  `096.txt  l108.txt  x120.txt
(040.txt  8056.txt  H072.txt  T084.txt  a097.txt  m109.txt  y121.txt
)041.txt  9057.txt  I073.txt  U085.txt  b098.txt  n110.txt  z122.txt
+043.txt  ;059.txt  J074.txt  V086.txt  c099.txt  o111.txt  {123.txt
,044.txt  =061.txt  K075.txt  W087.txt  d100.txt  p112.txt  }125.txt
0048.txt  @064.txt  L076.txt  X088.txt  e101.txt  q113.txt  ~126.txt
1049.txt  A065.txt  M077.txt  Y089.txt  f102.txt  r114.txt
~/MyDocs/collate $ ls | wc
       83        83       747
Linux partitions allow more characters in file names than FAT partitions.

Code:
~/collate $ ../bin/collate.pl 
touch: invalid option -- 0
BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso30+0m5) multi-call binary

Usage: touch [-c] FILE [FILE...]

touch: /047.txt: Permission denied
~/collate $ ls | wc
       91        91       819
~/collate $ ls
!033.txt  1049.txt  >062.txt  K075.txt  X088.txt  e101.txt  r114.txt
"034.txt  2050.txt  ?063.txt  L076.txt  Y089.txt  f102.txt  s115.txt
#035.txt  3051.txt  @064.txt  M077.txt  Z090.txt  g103.txt  t116.txt
$036.txt  4052.txt  A065.txt  N078.txt  [091.txt  h104.txt  u117.txt
%037.txt  5053.txt  B066.txt  O079.txt  \092.txt  i105.txt  v118.txt
&038.txt  6054.txt  C067.txt  P080.txt  ]093.txt  j106.txt  w119.txt
'039.txt  7055.txt  D068.txt  Q081.txt  ^094.txt  k107.txt  x120.txt
(040.txt  8056.txt  E069.txt  R082.txt  _095.txt  l108.txt  y121.txt
)041.txt  9057.txt  F070.txt  S083.txt  `096.txt  m109.txt  z122.txt
*042.txt  :058.txt  G071.txt  T084.txt  a097.txt  n110.txt  {123.txt
+043.txt  ;059.txt  H072.txt  U085.txt  b098.txt  o111.txt  |124.txt
,044.txt  <060.txt  I073.txt  V086.txt  c099.txt  p112.txt  }125.txt
0048.txt  =061.txt  J074.txt  W087.txt  d100.txt  q113.txt  ~126.txt
Attached Images
 
__________________
The Mini-USB plug is an improvement over both the Type B plug and the Micro-B plug.
 
Reply

Tags
collating, sequence


 
Forum Jump


All times are GMT. The time now is 16:36.