I recently upgraded my system from Etch to Lenny. Now when I use auto-complete, file names (not directories) appear with a trailing slash on the command line.
How do I fix this?
I have a directory structure as below:
Folder
> SubFolder1
> FileName1.abc
> Filename2.abc
> .............
> SubFolder2
> FileName11.abc
> Filename12.abc
> ..............
> ..........
etc. I want to rename the files inside the subfolders as:
SubFolder1_Filename1.abc
SubFolder1_Filename2.abc
SubFolder2_Filename11.abc
SubFolder2_Filename12.abc
i.e. add the folder name at the beginning of the file name with the delimiter "_". The directory structure should remain unchanged. Note: Beginning of file name is same. e.g. in above case File*.
I made below Script
for /r "PATH" %%G in (.) do (
pushd %%G
for %%* in (.) do set MyDir=%%~n*
FOR %%v IN (File*.*) DO REN %%v "%MyDir%_%%v"
popd
)
Problem with the above script is that it is taking only one Subfolder name and placing it to the beginning of file name irrespective of the folder.
In UNIX (OS X BSD to be precise), I have a "tail -f" command on a log file. From time to time I want to delete this log file so I can more easily review it in my text editor.
I delete the file, and then my program recreates it after new activity. However, my tail command (and anything else that was watching the old log file) doesn't update; it's still watching the old, deleted log file.
I think I understand why this is (file names simply being pointers to blocks of file data). I'd like to know how I can work around this. Ideally, my tail command (and anything else I point to the file) would be able to read the data from the new file when the file name has been deleted and recreated.
How would I do this?
In windows 7, i have a ton of files that have unnecessary prefixes and postfixes to their filenames. How can i, using some form of batch tool, remove them? ren didn't work on the command line.
I have printed a couple of files and lpstat shows that they are completed. But the output is something like this:
# lpstat -W completed -l
Canon-1 root 1086464 Sat May 21 22:47:03 2011
Alerts: job-canceled-by-user
queued for Canon
Canon-2 root 337920 Mon May 23 20:18:02 2011
Alerts: job-canceled-by-user
queued for Canon
CanonWin-3 root 17408 Mon May 23 20:29:40 2011
Alerts: job-completed-successfully
queued for CanonWin`
How can i get names of files which has been printed?
P.S. Is there is any bash-script which allows me to get names of all files which has been printed?
I run Microsoft windows on a few of my machines. I don't know if many people know about this issue in the OS but you can't have very long filenames, from what I know Linux can have longer names, I have never run into this issue on my Linux machines.
Anyway I run into issues whenever copying folders & files to backup drives. I manually backup of my data, finding and changing names of files, this is very very tedious.
Is there a software tool to shorten folders or filenames that are found to be to long on Windows?
I have drive image duplication software which does the job but in a way that I don't like, plus moving files can become a hassle at times if the names are too long to copy.
I have this url:
http://domain.com/wp-content/uploads/2012/10/Hvilke-vilkår-følger-med-når-du-bestiller-nyt-bredbånd.png
If I ftp/ssh or just browse to that folder (apache index feature), I see the file
Hvilke-vilkår-følger-med-når-du-bestiller-nyt-bredbånd.png
If I click on the link from the apache index, I can see the file, however, if I copy the URL and try to browse to it directly, I get the error:
The requested URL
/wp-content/uploads/2012/10/Hvilke-vilkår-følger-med-når-du-bestiller-nyt-bredbånd.png
was not found on this server.
Also my error log says:
File does not exist: /wp-content/uploads/2012/10/Hvilke-vilk\xc3\xa5r-f\xc3\xb8lger-med-n\xc3\xa5r-du-bestiller-nyt-bredb\xc3\xa5nd.png
I have files with naming convention
st009_out.abc1.dat
st009_out.abc2.dat
st009_out.abc3.dat
..................
..................
I am writing Python code where I want to use data from the file to perform a math function and need to extract the second column from the file. I have tried it this way:
for k in range(1,10):
file1=open('st009_out.abc'+str(k)+'.dat','r')
...........
os.system("awk '{print $2}' st009_out.abc${k}.pmf > raj.dat")
but this is not working as it is not taking the value of k in the shell command.
How do I progress?
Hi,
I'm sure I'm missing a trick here but I can't work out how to remove the trailing slash from a file name in a URL.
My URL would be something like this:
www.mysite.com/dynamic_folder_name/index.php/
I need the URL to become
www.mysite.com/dynamic_folder_name/index.php
Any help would be appreciated.
Cheers
I have a file that I'd like to reuse for a few different purposes. The file is 90% the same across uses, just slight differences. I'd rather not replicate the content across multiple files in puppet, so is there a way to do something like
file { "/tmp/file1" :
content => template("module/template.erb")
}
file { "/tmp/file2" :
content => template("module/template.erb")
}
And in the template:
Jack
John
James
<% if file == "/tmp/file2" %>
Jim
<% end %>
I am hoping someone can help me with this problem. I am moving to a new server and not using mod_pagespeed any more. However we have lots of external links to images on our site using the strange mod_pagespeed filenames. This is not an issue but we do not want to have lots of 404 errors.
So I have lots of links like the following :
http://www.domain.com/images/150x150xlink.png.pagespeed.ic.pPXw45HSQm.png
http://www.domain.com/images/paris_01.gif.pagespeed.ce.vfrkuKUaj0.gif
http://www.doamin.com/images/1st2.gif.pagespeed.ce.OUg38q6VbZ.gif
How can I redirect them to :
http://www.domain.com/images/150x150xlink.png
http://www.domain.com/images/paris_01.gif
http://www.doamin.com/images/1st2.gif
There are thousands of files like this so I am hoping for a simple solution with mod_rewrite, I tried this but it does not work. So any help would be appreciated.
RewriteCond %{REQUEST_URI} \.gif\.pagespeed\. [NC]
RewriteRule ^(.*?\.gif)\..*\.gif$ $1 [NC,L]
I want to execute this custom command on a file from the Gnome File Browser:
hexdump -C $f > $f.dump
That would create a hexdump of the file with the file's name + .dump in the directory that the file exists in. When I say $f above I mean something that would substitute the name of the file that was opened.
So I've tried "Open with", "Use a custom command". I can't get it to work. I've tried a number of symbols in place of $f. Is it even possible?
Before you suggest getting a GUI hexdump program, this is just one example. I have the need to do this sort of thing for many terminal-type programs.
Am I the only person on Earth who wishes for a hybrid File-Browser-slash-Command-Terminal? That would be a file browser which contained a terminal pane who's current directory always matched that of the file browser. One could execute shell commands in the context of what they were viewing in the browser.
Recently, I loaned my flash disk to one of my friends, who had Mac OS. He copied a file on it, whose name included a backslash (\).
The flash disk is NTFS formatted. Windows does not allow such filenames, and neither opens the file, nor deletes it, nor lets me delete the file.
There are naive approaches to this problem, like:
Formatting the flash disk;
Giving it back to my friend and asking to rename it;
Loading into some live Linux and renaming it.
However, I'm looking for something more clever, like a program that can do the trick under Windows.
PS: There's a tool called NTFSWalker which can browse the MFT records of the NTFS, but is unable to make any changes to them.
I have a text file with a list of server names (servers.txt) that looks something like this:
server1
server2
server3
I have a feeling this can be done with the FOR command as I use that to perform an action on each name in the file, but I'm not quite sure how to use the delimiters to accomplish this.
for /F "tokens=*" %%G in (servers.txt) do (
SET machinenum = <magic here>
ECHO %machinenum%
)
expected output
01
02
03
We are accessing SAMBA shared directory from a Windows Client with WebDav client WebDrive. But we are having the issue that it is showing same contents in both the directories ( data/ & Data/ ) though they are entirely different.
I know this is because of Windows Filesystem being case insensitive and Linux being Case Sensitive.
is there any solution for this?
We had the same issue when viewed through the SAMBA mounted directory but we solved it by editing the SMB.conf as said in the following link
Does Samba work well with Windows when case-sensitive names are enabled?
Please help to solve this when accessed from the WebDav
OS: Windows XP SP3
Is there tool that can get the selected file full path (like c:\PathToFile\target.file) to clipboard? And which be added to windows file context menu. So that can get path by right click on the file. Thanks.
I'm trying to setup a batch file to execute a set of stored procs and dump the output to a timestamped text file. I'm having problems finding the correct format for the timestamp.
Here is what I'm using
osql.exe -S <server> -E -Q "EXEC <stored procedure> " -o "c:\filename_%date:~-0,10%_%time:~-0,10%.txt"
The error I get is:
Cannot open output file - x:\filename_Thu 06/25/_16:26:43.1.txt
No such file or directory
I can't find the documentation and I've played around with it but can't find the correct format.
I usually just copy ~/.config/banshee-1, and ~/.gconf/apps/banshee-1 when i'm moving from one computer to the other, if I keep the path of the folders. I get to keep my music library intact with the playlists I have.
The problem with this method is that, the album arts doesn't carry over nicely. You'd have to play every album to get the album art to appear. Anyone knows a workaround, to maybe force banshee to reload all album art?
I saw this, but not quite what my issue is?
I tried banshee --fetch-artwork, but didn't work too well
kenneth@dv7:~$ banshee --fetch-artwork
[Warn 11:23:38.200] DBus support could not be started. Disabling for this sessi
on. - System.Exception: Error 111: Connection refused (in `dbus-sharp')
at DBus.Unix.UnixSocket.Connect (System.Byte[] remote_end) [0x00000] in <filen
ame unknown>:0
at DBus.Transports.UnixNativeTransport.OpenAbstractUnix (System.String path) [
0x00000] in <filename unknown>:0
at DBus.Transports.UnixNativeTransport.Open (System.String path, Boolean abstr
act) [0x00000] in <filename unknown>:0
at DBus.Transports.UnixTransport.Open (DBus.AddressEntry entry) [0x00000] in <
filename unknown>:0
at DBus.Transports.Transport.Create (DBus.AddressEntry entry) [0x00000] in <fi
lename unknown>:0
at DBus.Connection.OpenPrivate (System.String address) [0x00000] in <filename
unknown>:0
at DBus.Connection..ctor (System.String address) [0x00000] in <filename unknow
n>:0
at DBus.Bus..ctor (System.String address) [0x00000] in <filename unknown>:0
at DBus.Bus.Open (System.String address) [0x00000] in <filename unknown>:0
at DBus.Bus.get_Session () [0x00000] in <filename unknown>:0
System.Exception: Unable to open the session message bus. (in `dbus-sharp')
at DBus.Bus.get_Session () [0x00000] in <filename unknown>:0
at DBus.BusG.Init () [0x00000] in <filename unknown>:0
at Banshee.ServiceStack.DBusConnection.Connect (System.String serviceName, Boo
lean init) [0x00000] in <filename unknown>:0
at Banshee.ServiceStack.DBusConnection.GrabDefaultName () [0x00000] in <filena
me unknown>:0
[Info 11:23:38.286] Running Banshee 2.6.0: [Ubuntu 12.10 (linux-gnu, x86_64) @
2012-10-11 06:19:37 UTC]
(Banshee:21865): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Failed to connect to socket /tmp/dbus-vLxS6Riwsn: Connection refused
[Warn 11:23:38.948] Could not read GConf key core.send_anonymous_usage_data - G
Lib.GException: No D-BUS daemon running
(in `gconf-sharp')
at GConf.Client.Get (System.String key) [0x00000] in <filename unknown>:0
at Banshee.GnomeBackend.GConfConfigurationClient.TryGet[Boolean] (System.Strin
g namespace, System.String key, System.Boolean& result) [0x00000] in <filename u
nknown>:0
(Banshee:21865): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Failed to connect to socket /tmp/dbus-vLxS6Riwsn: Connection refused
[Warn 11:23:39.239] Could not read GConf key core.send_anonymous_usage_data - G
Lib.GException: No D-BUS daemon running
(in `gconf-sharp')
at GConf.Client.Get (System.String key) [0x00000] in <filename unknown>:0
at Banshee.GnomeBackend.GConfConfigurationClient.TryGet[Boolean] (System.Strin
g namespace, System.String key, System.Boolean& result) [0x00000] in <filename u
nknown>:0
In order to keep my Qt project somewhat organized (using Qt Creator), I've got one .pro file and multiple .pri files. Just recently I added a class to one of my .pri files that has the same filename as a class that already existed in a separate .pri file.
The file structure and makefiles generated by qmake appear to be oblivious to the filename collision that ensues. The generated moc_* files all get thrown into the same subdirectory (either release or debug, depending) and one ends up overwriting the other. When I try to make the project, I get several warnings that look like this:
Makefile.Release:318: warning: overriding commands for target `release/moc_file.cpp`
And the project fails to link.
Here is a simple example of what I'm talking about.
Directory structure:
+ project_dir
| + subdir1
| | - file.h
| | - file.cpp
| + subdir2
| | - file.h
| | - file.cpp
| - main.cpp
| - project.pro
| - subdir1.pri
| - subdir2.pri
Contents of project.pro:
TARGET = project
TEMPLATE = app
include(subdir1.pri)
include(subdir2.pri)
SOURCES += main.cpp
Contents of subdir1.pri:
HEADERS += subdir1/file.h
SOURCES += subdir1/file.cpp
Contents of subdir2.pri:
HEADERS += subdir2/file.h
SOURCES += subdir2/file.cpp
Is there a way to tell qmake to generate a system that puts the moc_* files from separate .pri files into separate subdirectories?
I have a directory with files that look like this:
001_something.php 002_something_else.php
004_xyz.php 005_do_good_to_others.php
I ultimately want to create a new, empty PHP file whose name starts with the next number in the series.
LIST=`exec ls $MY_DIR | sed 's/\([0-9]\+\).*/\1/g' | tr '\n' ' '`
The preceding code gives me a string like this:
LIST='001 002 004 005 '
I want to grab that 005, increment by one, and then use that number to generate the new filename. How do I do that in BASH?
In the ClickOnce "Application Files" files dialog, most of the entries for files are listed with the name "C". I have seen this on a colleague's machine for a different project as well. Has anyone else seen this and is there a way to get the correct filename inserted? We are both using VS 2008.
I'd like to have my PHP script upload a file with a certain filename in a directory of my choosing. However, the catch is that I need it to exist there immediately upon upload so I can moniter it on my server. I don't want to use a PHP extension or something - this should be very easy to transfer to any PHP setup.
So basically: Is there a way to guarantee that, from the very beginning of the file upload process, the file has a certain name and location on the server?
I want to serialize an object into an xml and I want the filename of the xml to be random as following
636211ad-ef28-47b9-aa60-207d3fbb9580.xml
fc3b491e5-59ac-4f6a-81e5-27e971b903ed.xml
I am just curious on how to do such thing?
I have a script running on Ruby 1.9.1 on Windows 7
I've distilled my script down to
File.open("????.txt")
and still can't get it to work. I know there are issues with Ruby 1.9 filename handling on windows (Using the Windows ANSI library), but would be happy enough with a work around that is callable from Ruby
I'd like to script p4 a little. Unfortunately, some of the filenames that we're tracking have "@" in the filename.
The filenames are in the form [email protected]. If I try to do something like p4 sync a\@b.xml on a mac (or p4 sync [email protected] on windows) it gives the error:
Invalid changelist/client/label/date '@b.xml'
Is there another way to escape it that perforce will recognize?