Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
ezharkov
PostPosted: Feb 24, 2012 - 01:11 AM
Resident


Joined: Jun 21, 2005
Posts: 882
Location: Chicago area, USA

Let's say I have two files, foo.txt and foo.txt~. When I do "dir *.txt", it shows both. Is there any way to tell Windows not to show the one with tilde?
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: Feb 24, 2012 - 01:15 AM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21272
Location: Orlando Florida

del *.*~ then dir

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
ezharkov
PostPosted: Feb 24, 2012 - 01:23 AM
Resident


Joined: Jun 21, 2005
Posts: 882
Location: Chicago area, USA

Smile - something a little bit more gentle, please!
 
 View user's profile Send private message  
Reply with quote Back to top
zbaird
PostPosted: Feb 24, 2012 - 01:49 AM
Raving lunatic


Joined: Aug 13, 2006
Posts: 6707
Location: Bellingham, WA - USA

Oh. Miralax, not Ex-Lax.

(some day you'll be old, too)

I think in many or most situations Uncle Bob's second asterisk will take precedence and the tilda will be ignored, and your dir command will feel quite lonely and unloved.

_________________
Chuck Baird
"It's better to catch the trapeze than test the safety net" -- RPi book
http://www.cbaird.org
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
zbaird
PostPosted: Feb 24, 2012 - 02:06 AM
Raving lunatic


Joined: Aug 13, 2006
Posts: 6707
Location: Bellingham, WA - USA

Well, it appears to have to do with the tilda being the 4th character (and falling off into the extended name field). If you try it with files named foo.tx and foo.tx~ or foo.txtt and foo.txtt~ it works just fine.

Can you get the tilda out of the 4th position?

_________________
Chuck Baird
"It's better to catch the trapeze than test the safety net" -- RPi book
http://www.cbaird.org
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
bobgardner
PostPosted: Feb 24, 2012 - 02:59 AM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21272
Location: Orlando Florida

maybe del *.???~

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
zbaird
PostPosted: Feb 24, 2012 - 03:08 AM
Raving lunatic


Joined: Aug 13, 2006
Posts: 6707
Location: Bellingham, WA - USA

I don't think he wants to delete them, Uncle Bob, although that would make his life easier.

A pipe (that thing the internet is made out of), a grep, and a jug o' happiness.

_________________
Chuck Baird
"It's better to catch the trapeze than test the safety net" -- RPi book
http://www.cbaird.org
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
bobgardner
PostPosted: Feb 24, 2012 - 03:23 AM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21272
Location: Orlando Florida

A Loaf of Bread, A Jug of Wine, And Thou beside me in the wilderness. Omar Kayyam "The Ruby Yacht". Guess that would be "The Red Boat" down here in Florida.

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
sbennett
PostPosted: Feb 24, 2012 - 03:52 AM
Resident


Joined: Nov 19, 2001
Posts: 918
Location: San Luis Obispo

Pipe the dir output through the find command to NOT find the string ".txt~" or simply "~"
any lines containing the offending string will not be sent to the screen.

dir | find /V ".txt~"
 
 View user's profile Send private message  
Reply with quote Back to top
zbaird
PostPosted: Feb 24, 2012 - 03:59 AM
Raving lunatic


Joined: Aug 13, 2006
Posts: 6707
Location: Bellingham, WA - USA

Grep, find, toe-may-toe, toe-ma-toe. Bring on the jug o' happiness on the deck of the red boat.

_________________
Chuck Baird
"It's better to catch the trapeze than test the safety net" -- RPi book
http://www.cbaird.org
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
clawson
PostPosted: Feb 24, 2012 - 09:50 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62354
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

When I do "dir *.txt", it shows both. Is there any way to tell Windows not to show the one with tilde?

Which MS-DOS? When I do that in XP SP3 I get:
Code:
E:\avr>dir *.c?
 Volume in drive E is VBOX_windows
 Volume Serial Number is 0000-0805

 Directory of E:\avr

15/02/2012  11:47                39 add.c
24/02/2012  09:47                 0 foobar.c~
04/10/2011  09:48               365 bitstruct.c
02/11/2011  17:48               228 justtest.c
30/08/2011  08:00                 0 FlIbBlE.c
29/01/2012  17:51             3,272 foobar.c
29/09/2011  09:32             2,151 test_flags.c
07/11/2011  10:10                61 data.c
30/10/2011  15:02                 0 foo1.c
22/02/2012  15:52               609 test.c
06/11/2011  17:07            36,761 second.c
02/07/2011  19:45            12,873 fpbench32.c
29/07/2011  09:00               652 foo.c
24/02/2012  09:47                 0 bitstruct.c~
11/09/2011  16:11               356 astest.c

but when I do:
Code:
E:\avr>dir *.c
 Volume in drive E is VBOX_windows
 Volume Serial Number is 0000-0805

 Directory of E:\avr

15/02/2012  11:47                39 add.c
04/10/2011  09:48               365 bitstruct.c
02/11/2011  17:48               228 justtest.c
30/08/2011  08:00                 0 FlIbBlE.c
29/01/2012  17:51             3,272 foobar.c
29/09/2011  09:32             2,151 test_flags.c
07/11/2011  10:10                61 data.c
30/10/2011  15:02                 0 foo1.c
22/02/2012  15:52               609 test.c
06/11/2011  17:07            36,761 second.c
02/07/2011  19:45            12,873 fpbench32.c
29/07/2011  09:00               652 foo.c
11/09/2011  16:11               356 astest.c

No ~ entries listed with just "*.c" - I had to use "*.c~" in the first command to be sure the *~ files were listed.

PS of course if you have WinAVR on your machine you have access to "ls" Wink

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
steve17
PostPosted: Feb 24, 2012 - 11:11 AM
Raving lunatic


Joined: Sep 07, 2004
Posts: 2528
Location: New York State

Yes, ls will do it right.

Dir works right for me if I run it from powershell instead of cmd.
 
 View user's profile Send private message  
Reply with quote Back to top
ezharkov
PostPosted: Feb 24, 2012 - 11:14 AM
Resident


Joined: Jun 21, 2005
Posts: 882
Location: Chicago area, USA

Well, tried ls.exe from WinAVR 20100110. It worked! ls.exe that I normally use, an older version, does not...

EDIT: And "WinAVR-20100110\utils\bin\grep.exe something *.txt" worked too (i.e., does not show stuff from files with tilde). That is why I started this thread in the first place. I guess it is really time for me to upgrade my UnxUtils set.


Last edited by ezharkov on Feb 24, 2012 - 11:30 AM; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Feb 24, 2012 - 11:25 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62354
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

But I do not think it matters

But you are saying you get a different result with "dir" in XP than I see? As I say if I use "dir *.c" I *only* see files with ".c" as an extension and none with ".c~". Perhaps they fixed it in SP3 (which I use)?

I thought it might be something to do with 3 character extensions rather than 1 character but I get the same with:
Code:
E:\avr>touch test.txt

E:\avr>touch test.txt~

E:\avr>dir *.txt
 Volume in drive E is VBOX_windows
 Volume Serial Number is 0000-0805

 Directory of E:\avr

24/02/2012  11:23                 0 test.txt
               1 File(s)              0 bytes
               0 Dir(s)  240,665,268,224 bytes free

E:\avr>dir *.txt*
 Volume in drive E is VBOX_windows
 Volume Serial Number is 0000-0805

 Directory of E:\avr

24/02/2012  11:23                 0 test.txt~
24/02/2012  11:23                 0 test.txt
               2 File(s)              0 bytes
               0 Dir(s)  240,665,268,224 bytes free

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
ezharkov
PostPosted: Feb 24, 2012 - 11:44 AM
Resident


Joined: Jun 21, 2005
Posts: 882
Location: Chicago area, USA

Quote:
Perhaps they fixed it in SP3 (which I use)?
Tried on SP3. No, still see the problem. But then again, perhaps they fixed it in some patches. On the other hand, I think I saw the same thing at work on Windows 7 ... I will double check and report back in an few hours. But WinAVR-20100110's grep.exe works fine, so I am good.
 
 View user's profile Send private message  
Reply with quote Back to top
steve17
PostPosted: Feb 24, 2012 - 12:04 PM
Raving lunatic


Joined: Sep 07, 2004
Posts: 2528
Location: New York State

The dir command has the problem on Win7 when it is run from the cmd shell. It is a built in command with this built in "feature".

Powershell implements dir differently and it works right.

Cygwin also has a dir.exe in /bin that works right.

And of course if you are running bash and have dir as an alias for ls, that works right too.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Feb 24, 2012 - 12:56 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62354
Location: (using avr-gcc in) Finchingfield, Essex, England

Just checked in case I was using a different "dir" but it sure looks like I'm getting the one in CMD.EXE:
Code:
E:\avr[i386_vc]>which dir.exe
which: no dir.exe in (c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;c:\Program Files\Microsoft Visual Studio
9.0\VC\BIN;c:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools;c:\WINDOWS\Microsoft.NET\Framework\v3.5;c:\WINDOWS
\Microsoft.NET\Framework\v2.0.50727;c:\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages;C:\Program Files\Microsof
t SDKs\Windows\v6.0A\bin;C:\asl\P2\components\..\..\tools\bin;C:\asl\P2\components\..\..\tools\cmake-2.8.2-win32-x86\bin
;C:\Qt\4.7.2\bin;C:\asl\P2\components\..\darc_externLib\OpenCV_1.1;C:\asl\P2\components\..\darc_externLib\OpenCV_1.1\bin
;C:\Program Files\Common Files\Microsoft Shared\Windows Live;E:\WinAVR-20100110\bin;E:\WinAVR-20100110\utils\bin;C:/Prog
ram Files/Texas Instruments/xdctools_3_22_01_21;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\syste
m32\WindowsPowerShell\v1.0;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Graphviz2.26.3\bin;C:\Program Files\SciTool
s/bin/pc-win32;C:\Program Files\Support Tools\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Fi
les\ATMEL Corporation\SAM-BA v2.10\drv\;C:\Program Files\ATMEL Corporation\SAM-BA v2.10;C:/Program Files/Texas Instrumen
ts/xdctools_3_22_01_21;C:\Program Files\OpenVPN\bin;C:\mingw\bin;E:\SysinternalsSuite;C:\Program Files\Common Files\Micr
osoft Shared\Windows Live;E:\WinAVR-20100110\bin;E:\WinAVR-20100110\utils\bin;C:/Program Files/Texas Instruments/xdctool
s_3_22_01_21;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Progr
am Files\TortoiseSVN\bin;C:\Program Files\Graphviz2.26.3\bin;C:\Program Files\SciTools/bin/pc-win32;C:\Program Files\Sup
port Tools\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\ATMEL Corporation\SAM-BA v2.10\
drv\;C:\Program Files\ATMEL Corporation\SAM-BA v2.10;C:/Program Files/Texas Instruments/xdctools_3_22_01_21;C:\Program F
iles\OpenVPN\bin;C:\mingw\bin;E:\SysinternalsSuite)

Oh and:
Code:
E:\avr[i386_vc]>set | grep -i comspec
ComSpec=C:\WINDOWS\system32\cmd.exe

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
steve17
PostPosted: Feb 24, 2012 - 01:41 PM
Raving lunatic


Joined: Sep 07, 2004
Posts: 2528
Location: New York State

Cliff, you apparently have the only cmd prompt DIR in existance that works properly. Do you know someone in Redmond?

There are options that can be set in the DIRCMD environment variable, but as far as I know they are the same options you can give on the command line, and I can't find any that make it work right.

One difference I see is you use day/month/year format, but that would be weird if it affected this.

I even booted up ye olde XP SP3 and it doesn't work right. Here's what I got:
.
 
 View user's profile Send private message  
Reply with quote Back to top
ezharkov
PostPosted: Feb 24, 2012 - 01:50 PM
Resident


Joined: Jun 21, 2005
Posts: 882
Location: Chicago area, USA

Tried on Windows 7. Same issue. Cliff, where did you get your Windows from?

Tried this also:
Code:
#include <stdio.h>
#include <windows.h>
int main(void) {
  static WIN32_FIND_DATA findData;
  HANDLE handle = FindFirstFile("*.txt", &findData);
  if (handle == INVALID_HANDLE_VALUE)
    printf("Error\n");
  else {
    do {
      printf("Name=<%s>\n", findData.cFileName);
    } while (FindNextFile(handle, &findData));
  }
}
Same thing. I.e., it is in Win32 API.
 
 View user's profile Send private message  
Reply with quote Back to top
dksmall
PostPosted: Feb 24, 2012 - 02:39 PM
Raving lunatic


Joined: Apr 16, 2001
Posts: 3522
Location: Phoenix, Arizona

Have you tried setting the hidden attribute?
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits