Problem renaming File

Hello,
I have a problem about renaming file. This is the file.
"C:\Documents and Settings\Rose 2\Desktop\download directory\5406-5473\a " . It has no extension so I need to add extension(.mp3). here's my code:
            File mFile = new File(soundFile.getParent(),"a.mp3");
            soundFile.renameTo(mFile);
            System.out.println(mFile.toString());
            if (mFile.exists()) {
                setAudiofile(mFile);
            } else {
                System.out.println("mFile does not exist");
            }the soundFile variable is the original file. The output of my code is nothing and I don't see a.mp3.
Result of System.out.println(mFile .toString()) :
C:\Documents and Settings\Rose 2\Desktop\download directory\5406-5473\a.mp3
Thanks in advance and Happy New year!!!

The output of my code is nothing and I don't see a.mp3.But you posted some output...
Anyway try if (mFile.exists()) {
    System.out.println("mFile *does* exist");
    setAudiofile(mFile);
} else {
    System.out.println("mFile does not exist");
}What is the output?
By the way, your code gives no hint as to what setAudiofile() does - including the possibility, albeit unlikely, that it deletes a.mp3. Rather than post a snippet excised from a longer piece of code, construct a SSCCE that illustrates renameTo() not working.
http://homepage1.nifty.com/algafield/sscce.html

Similar Messages

  • Renaming file problem

    hi
    i'm having a problem renaming a file in java.
    i'm trying to delete a string from a file and the only thing that seems rationaly to me is to search the string out take the strings before and after and concatinate them into a new file. i'm not sure if this is the best way or the easiest but it seems the most logical to me right now.
    the problem now is renaming the temp file into the original file name. how do i do that properly? i've tried renameTo(); but i'm having problems with that i'm getting an invalid IO error.
    Please help
    Thanks a lot

    Hi
    I normally use a replace function that I found on this forum earlier this year. If you want to use it on a file you can do it as follows and then there is no need to work with 2 files. (You see that the string that I use for replacement is empty, so in effect it deletes the strings that you don't want.).
    import java.io.*;
    public class FindReplace {
    public static void main (String args[]) {
    try {
    RandomAccessFile file = new RandomAccessFile("testfile", "rw");
    String oString;
    String nString;
    long len = file.length();
    byte[] b = new byte[(int)len];
    file.readFully(b);
    oString = new String(b);
    nString = replace(oString, "old", "", true);
    file.seek(0);
    file.writeBytes(nString);
    // in case the "new file" is shorter than the old one
    // truncate the rest of the file, this ensures we don't
    // have duplicate content at the end of the file
    long nlen = file.getFilePointer();
    if (nlen < len) {
    file.setLength(nlen);
    file.close();
    } catch (IOException ioe) {
    System.out.println("Error during processing: " + ioe);
    public static String replace(String str, String o, String n, boolean all) {
    if (str == null || o == null || o.length() == 0 || n == null)
    throw new IllegalArgumentException("null or empty String");
    StringBuffer result = null;
    int oldpos = 0;
    do {
    int pos = str.indexOf(o, oldpos);
    if (pos < 0)
    break;
    if (result == null)
    result = new StringBuffer();
    result.append(str.substring(oldpos, pos));
    result.append(n);
    pos += o.length();
    oldpos = pos;
    } while (all);
    if (oldpos == 0) {
    return str;
    } else {
    result.append(str.substring(oldpos));
    return new String(result);
    }

  • What is the name of the process that renames File & Folders? To fix name entry problem?

    What mac linux process found in the Activity Monitor renames files and folders? My mac is slow under mac osx 10.7.5 and nearly unusable to name files and folders since as you name them it will jump the cursor and highlight causing the name I put in to disappear. I hate this so much I'm looking at a windows box! So what process can I raise priority of to help with this severe problem?

    aaron-
    Premiere Elements 12 on Windows 7 (assumed 64 bit)
    Have you updated 12 to the 12.1 Update using an opened project's Help Menu/Update? If not, please do so.
    If you are referring to that red stem with the blue head at the Timeline level in the Expert workspace, that is indeed the Timeline Indicator (also referred to as CTI).
    To be ruled in or out at the onset...whether or not you see an orange line over the Timeline content that you are attempting to preview?
    If you (manually) or the project (automatically) have set the correct project preset, there should be no colored line
    of the source video when it is first dragged to the Timeline. That is the program telling you that you are getting
    the best possible preview. If orange, you are not and need to "Render" the Timeline content to get the best possible preview.
    Does this "Timeline Rendering" factor apply to your situation?
    If you are getting the best possible preview, we still need to know the properties of your source media ---
    video compression
    audio compression
    frame size
    frame rate
    interlaced or progressive
    pixel aspect ratio
    Often the above can be gathered from knowing brand/model/settings for the camera that recorded the video.
    Also are you observing this behavior if you start a new project or use different source media, such as, stills or videos
    recorded with a different format?
    Let us start here and then decide what next.
    Thank you.
    ATR

  • Problem in renaming file

    hi
    There are 2 files in a directory called
    js1.html
    js2.html
    i am reading from js1.html and making some modification to
    the data as i read and storing in js2.html
    finally i have to rename js2.html to js1.html
    i am using fileinputstream and fileoutputstream amd i am
    closing both before ranaming.
    I also am trying to delete js1.html before renaming
    as both are in the same dir
    The code i am using for renaming
    File old=new File("js2.html");
    old.renameTo(new File("js1.html");
    But this always returns false
    i am using win2k
    could anyone pls help me out with this
    thanks

    Just a guess but maybe it is returning false because you already havea file named js1.html. Trying doing this through Windows Explorer and it will spit out an error.
    What you should try is deleting js1.html first and then renaming. Presumably you don't need js1.html anymore once you make the changes so go ahead and delete it.

  • Problem rename temp file

    Hi all, I´m using oracle 9.2.0.4 and I ´m trying to do a rename of a temp
    file, so I´ve tried to do this:
    1- shutdown immediate;
    2- move the file to new local;
    3- startup mount;
    4- alter database rename file
              '/oracle1/oradata/devdb/data/basic/tbs_temp_basic01.dbf'
          to '/oracle_1/oradata/devdb/data/basic/tbs_temp_basic01.dbf';
    5- open.but the following error occurs:
    ERROR at line 1:
    ORA-01511: error in renaming log/data files
    ORA-01516: nonexistent log file, datafile, or tempfile
    "/oracle1/oradata/devdb/data/basic/tbs_temp_basic01.dbf"I did not understand this error cause in the new local, the file exists.
    So, I´ve tried to do a copy instead of move, but the error persists.
    Somebody can help me?
    thank U
    []´s

    Hi,
    What's the significance of renaming a temp file ?
    Simply drop this file and create a new one....
    You have two options :
    Solution 1
    Drop the temporary locally-managed tablespace and recreate it
    assigning the tempfiles in the new destination.
       SQL> select file_name, tablespace_name from DBA_TEMP_FILES;
       FILE_NAME                                           TABLESPACE_NAME
       /V816/temp01.dbf                                    USER_TEMP_1 
       SQL> drop tablespace user_temp_1;
       Tablespace dropped.
       SQL> create temporary tablespace user_temp_1
         2  tempfile '/V816/temp02.dbf' size 2M extent management local;
       Tablespace created.
    Solution 2
    Drop the tempfile and add a new one to the tablespace. Then remove the OS file.
       SQL> alter database tempfile '/V90164/temp02.dbf' drop;
       Database altered.
       SQL> alter tablespace USER_TEMP_1 add tempfile '/V90164/temp03.dbf' size 2M;
       Tablespace altered.
       $ rm /V90164/temp02.dbf
    In 9i, you can drop the tempfile and the OS file within the same statement:
       SQL> alter database tempfile '/V901/temp02.dbf' drop including datafiles;
       Database altered.
       SQL> alter tablespace USER_TEMP_1  add tempfile '/V90164/temp03.dbf' size 2M;
       Tablespace altered.

  • Rename files or folders in Windows 8 not working

    Rename a file or folder on a Windows CE device is not working from Windows 8 when connected through Windows Mobile Device Center.
    From Windows 7 it worked just fine!
    This has been a problem for a very long time now, and im not alone according to all forums.
    But no fix as far as i can find!
    Is there anyone that have found a fix on this?

    http://answers.microsoft.com/en-us/windows/forum/windows8_1-files/windows-8-unable-to-rename-files-on-pocket-pc/abae21b7-7ee1-41c7-853e-1ac7ea5b0413
    It seems a issue in window 8.x system. Maybe you can ask for a MS support ticket. 

  • Sharepoint 2013 ItemAdded event receiver for renaming files is not working

    In SP 2013 I coded an event receiver that intercepts the ItemAdded event and it just renames the file.
    It is a synchronous event (I added <Synchronization>Synchronous</Synchronization> in the Elements.xml).
    This is the code:
            public override void ItemAdded(SPItemEventProperties properties)
                SPSecurity.RunWithElevatedPrivileges(delegate()
                    try
                        OutputDebugStringA("Inside ItemAdded");
                        string szHttpUrl = properties.WebUrl + "/" + properties.AfterUrl;
                        SPWeb openedWeb = properties.Web.Site.OpenWeb(properties.Web.ID);
                        SPFile spf = openedWeb.GetFile(szHttpUrl);
                        EventFiringEnabled = false;
                        string szUrl = properties.AfterUrl;
                        szUrl = szUrl + ".renamed";
                        string szNewFileName;
                        if (szUrl.LastIndexOf('\\') != -1) szNewFileName = szUrl.Substring(szUrl.LastIndexOf('\\') + 1);
                        else if (szUrl.LastIndexOf('/') != -1) szNewFileName = szUrl.Substring(szUrl.LastIndexOf('/') + 1);
                        else szNewFileName = szUrl;
                        if (properties.ListItem != null)
                            properties.ListItem["Title"] = szNewFileName;
                            properties.ListItem.Update();
                        spf.MoveTo(szUrl);
                        EventFiringEnabled = true;
                        base.ItemAdded(properties);
                        OutputDebugStringA("Renaming to " + szUrl);
                    catch (System.Exception exception)
                        OutputDebugStringA("ItemAdded ERROR: " + exception.ToString());
    The problem is that when I upload a .txt file using Internet Explorer, just after the renaming is done, IE says that something went wrong and when I inspect the log files I see:
    SPRequest.GetFileAndFolderProperties: UserPrincipalName=i:0).w|s-1-5-21-4050800873-4278272723-3073177257-500, AppPrincipalName= ,bstrUrl=http://sp2013/sites/demo/subsite1 ,bstrStartUrl=Shared Documents/test2.txt ,ListDocsFlags=16400 ,bThrowException=True 0fa7689c-674b-5045-c3a2-b214a5d4cbed
    01/09/2014 15:29:26.75  w3wp.exe (0x1544)                        0x16F4 SharePoint Foundation        
     General                        ai1wu Medium   System.IO.FileNotFoundException: <nativehr>0x80070002</nativehr><nativestack></nativestack>,
    StackTrace:    at Microsoft.SharePoint.SPWeb.GetFileOrFolderProperties(String strUrl, ListDocsFlags listDocsFlags, Boolean throwException, SPBasePermissions& permMask)     at Microsoft.SharePoint.SPFile.PropertiesCore(Boolean
    throwException)     at Microsoft.SharePoint.SPFile.get_Length()     at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadPage.OnSubmit(Object o, EventArgs e)     at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadExPage.OnSubmit(Object
    o, EventArgs e)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeSta... 0fa7689c-674b-5045-c3a2-b214a5d4cbed
    ...gesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext
    context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr
    rootedObjectsPointer, IntPtr nativeRequestContex... 0fa7689c-674b-5045-c3a2-b214a5d4cbed
    ...t, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr
    pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr
    rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) 
     0fa7689c-674b-5045-c3a2-b214a5d4cbed
    So it is clear that the fact that I renamed the file is causing an issue in the SharePoint upload logic.
    As a solution what I did was to not declare it as Synchronous, but if I do it then there is another error when Sharepoint shows the Edit Properties dialog... in this case the upload is OK but when it is time to show that Edit Property dialog IE fails and
    says that the file has been already modified, or that "something went wrong".
    If I use a synchronous event I get one problem. If I use the asynchronous event I get another problem... It's very frustating and I am pretty sure that a so important API like Event Receivers should have support renaming files so I hope someone can tell
    me what I am doing wrong.
    Thanks in advance

    May be you want to consider using the following code and see if it works for you.
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/40c78e03-2dca-4083-89d2-a7430099da68/how-do-i-change-the-name-property-of-a-file-in-a-document-library?forum=sharepointdevelopment
    Amit

  • Problem with FIle Adapter

    Hi
    We r facing typical problem with file adapter.
    Lets say there are 30 files to be processed  by placing an copy in arichive folder by file adapter  based on pooling 
    parameters.
    All the 30  files are picked up and we can see the copies in archive folder.
    But when we go to RWB and check the audit log,
    there we could see only 25 files , the 5 files are missing.
    no trace found therre about the 5 files.
    This is happening only some times and not to all the files placed in the FTP. Later when the same file is placed back from the Archive folder to the Source folder, the file is being picked and processed succesfully.
    unfortunately this is happening on Production server
    Any pointers which could trouble shoot this issue.
    Regards
    shekar chandra

    Hi,
    Couple of thing which you can try....
    1. Use EOIO QoS and check if you still face the issue.
    Is some program or application writing files to the directory? If yes I would recommend the use of a temporary name to write the files and then rename them.
    Sometimes when an external application connects via FTP and transfers the files...
    The file could be picked up by the adapter poll even before the transfer of data is done.
    Which is why you will find that the file is archived but there is no xml message created for the same in the Integration engine.
    Try increasing the poll interval. This helps sometimes.
    Regards,
    Sidharth

  • Deleting & renaming files - is there a shortcut to finder?

    I am a recent convert from PC to Mac. So far so good. However, one thing starts to drive me up the wall which is deleting/renaming files in programs such as photoshop, word, excel etc.etc.
    As far as I can tell, this is only possible in the finder menu. Is this Correct? I am using a lot of folders and subfolders - sometimes 3-4 levels deep. Every time I need to change/delete a file or filename - lets say while in photoshop, I have to go to finder and click my way through several levels of folders to the actual file I need to change. This is somewhat annoying and timeconsuming.
    Question 1: is there a way to do these operations in - lets say photoshop directly?
    Question 2: If not, is there a shortcut key that would point me automatically to the file in finder where I can make the changes?
    Your input would be very helpful and save me some aggravation.
    fupe

    Hi Greg,
    Thanks for your input. You are correct as far as "save" and "save as" is concerned. Windows and Mac work the same way.
    However, as far as I can tell, in Mac you can only "delete" or "rename" a file in "finder" which forces you to open up finder and locate the file in order to delete or change it.
    In windows you can do these 2 functions directly in the program (such as photoshop, excel or words). You do not have to go to "explorer or root directory" to make these changes which I believe would be the equivalent of "finder".
    In any case, Terence solved the problem. By command clicking the name (title) of the file in any program, it opens up the directory in "finder". This way makes it easy to select the file and do the changes.
    fupe

  • Can't delete, rename files, or move to another folder

    I had posted earlier about not being able to delete, rename files, or move to another folder. It never was resolved here, and I guess Apple still hasn't done anything about it. Here's a great workaround I found though in case others need something. Download the program called "Unlocker", it's free and you can get it at http://ccollomb.free.fr/unlocker/ When you get the message about the file being in use, even though QuickTime isn't even open, you can unlock the f'ing file and do whatever you want to then, move, uh DELETE, or rename, or whatever. Try it, it's the best thing going so far seeing Apple isn't doing anything about this problem.

    Hi there,
    I am still struggling with this problem. Actually my coworker has the same machine, Apple pro with windows xp installed, but he does not have this problem with his quicktime 7.5. I uninstalled 7.5 and installed 7.2, but it did not solve the problem. The fact is that I don't have the problem in my laptop which I am using it in the office. I am still trouble shooting. Hopefully I can find an answer.
    Peace

  • Problem with file permissions using Snow Lepord

    I'm having problems with file Sharing & Permissions using Snow Lepord.
    When I save any new file it only has 'Read & Write' privileges for the user, everyone else is 'read only' or 'no access'.
    We have a Netgear NAS Server which is accessed by other users over the local network and if I change the Privilege to 'read & write' via Get Info and then copy the file from my desktop to ther server it changes the Privilege of the server version to 'no access' we then have to change it again for it to work.
    I also created a new folder on the server and now it says 'no access' and has a no entry icon!
    Any ideas???

    We have issues like this. Have tried running AFP and SMB, now connecting using CIFS. All have the same problem. I can work on one or two files fine, then suddenly, one of the files I just worked on says I don't have permissions. I log off the server and log back on, and then I have permissions to the file. It will work fine for one or two operations, then fails. We just updated to OSX Mavericks and a Windows 2012 server, but have been having this issue for years. My permissions look fine. I can even change permissions, but it won't let me work on the file or move or delete the file or rename the file. Once I log out and log back in, I can do anything I want.

  • Automator: Impossible to rename file using automator under Mac OS X Lion

    Hi,
    Before upgrade my iMac to MAC OS X Lion 10.7.2, I had service created with automator under snow leopard in order to rename my pictures file names by blocks instead of one by one. Since I'm using Lion, this one doesn't work anymore. I have completely recreate the service under Lion and the results is the same.
    You can find below my workflow that is easy. The problem is the message error in the history of automator application. The message is "impossible to rename file "file name" because this one should create conflict with existing file". I already test a lot of times with different name where I'm sure that this one doesn't exist on my Mac but all the time without success (verify also with search function under mac)
    If somebody can help me, it would be very interesting because I already tried to find answer on internet without success too.
    Thanks in advance for your help.

    the whole automator and in particular the record action was substantially rewritten in snow leopard. and the record action is slow, unreliable and you can't trouble-shoot it. it's a wonder it works at all. the only advice i can give is to use it as little as possible. if at all possible avoid it altogether. if you do need to use it try using keyboard strokes instead of the mouse movement. for example. use command+c and command+v for copying and pasting and use tabbing to choose the correct box on the page.

  • Renaming files with invalid characters in their names on NTFS partitions, introduced by operating systems other than Windows

    Essentially, Linux created some files with colons (:) in the name on a NTFS partition where I have Windows installed. I have since uninstalled Linux, but now I can only view these files in Windows Explorer. I can't open them, I can't even rename them to
    correct the problem. It's as if they don't exist, because of the invalid search paths.
    If I try to rename them in Windows Explorer I get following message.
    The file name you specified is no valid or too long.
    Specify a different file name.
    Well isnt' that something?... isn't that nice? Windows is able to display these files, but it doesn't allow me to open them and it certainly doesn't like me to rename them. So why is it whining about it then, when I'm trying to help? It says "try a different
    file name". Yeah, right! Like I haven't tried that one already! It doesn't matter what file name I input it will never accept it.
    So what am I supposed to do now? Ditch Windows and go back to Linux? Surely, Microsoft doesn't like the sound of that. Sure, I could reinstall Linux or run a Linux live system to correct the problem. But what good is Windows then? I might as well switch to
    Linux altogether.
    After doing some research I now know by fact that it's (kind of) possible to rename files from UNIX and UNIX-like operating systems to those compliant with Windows by using something called file name character translation. To some level this is essential and
    necessary for Windows interoperability with other operating systems (Windows is not the only operating system in the world). But this seems to be very complicated and I can't get my head around it. My brain is in overload. I don't know where to start.
    Once there was a...
    There's the Windows Services for UNIX (SFU) 1.0, 2.0, 3.0, 3.5. The first two versions were based on MKS Toolkit, a package licensed by Microsoft from MKS Inc. The later versions were based on the similar Interix product, after Microsoft purchased the company
    that made it.
    Then there's the new Subsystem for UNIX-based Applications (SUA). These are services for UNIX components. They are supposed to have Client for NFS v3 included as well. But the server components from the SFU line is missing (e.g. Server for NFS). These are included
    in Server editions of Windows.
    Then there's the Microsoft Knowledge Base article
    289627: "How to Enable File Name Character Translation". This article seems to describe exactly my situation.
    Windows and UNIX operating systems have restrictions on valid characters that can be used in a file name. The list of illegal characters for each operating system, however, is different. For example, a UNIX file name can use a colon (:), but a Windows
    file name cannot use a colon (:). If a UNIX user attempts to create a file with a Windows illegal character on a Windows Services for UNIX network file system (NFS) share, the attempt is unsuccessful and the UNIX client computer receives an input or output
    error.
    It goes further than that. At first glance, this KB article also seems to offer a solution to this exact problem, with examples as shown below.
    For example, the following maps the UNIX colon (:) to a Windows dash (-):
    0x3a : 0x2d ; replace client : with - on server
    I checked these values in charmap.exe and they are correct. Except for 2D not being a "dash", it's rather a hyphen ("hyphen minus" to be exact), but these two have pretty much the same appearance and they get interchanged a lot, I'm sure
    they are used to it by now. (Yes, the characters! They don't mind.)
    Then there's this registry key.
    HKEY_LOCAL_MACHINE\Software\Microsoft\Server For NFS\CurrentVersion\Mapping
    Well, of course, I don't have Server for NFS. So this is a dead end. Well, actually, it was a dead end from the beginning...
    1. First of all, I'm not working with a network share on a NAS or SAN storage. The files are on the local disk drive where Windows is installed, so that's a DAS for you.
    2. I don't have SFU! Well obviously, I'm on Windows Vista! So that means SUA!
    3. SUA are service components only. No server components. Can you guess what that means? Yeah... no "Server for NFS" since it's a server component.
    4. Windows Vista is a client side operating system! Server for NFS is only offered for use with Windows Server systems.
    5. Back to square one!
    So there you have it. They all lived happy for the rest of their lives...
    I'm stuck here. Can someone tell me what to do? I mean beyond the obvious option to use Linux to fixa a Windows problem? The NTFS file system itself supports colons in file names. It's Windows that doesn't, and so by default it proclaims it invalid character.
    Surely, even a Windows client operating system like Windows Vista should be able to allow the user to at least rename files with invalid characters to something more sensible (from the system point of view) and valid, if not being able to open them as they
    are. Just add some crazy voodoo code to it and it will work. If you can make it possible on Windows Server with UNIX user-mode subsystem on NT kernel, then what's stopping you from giving the Windows client system the same benefit?
    So what now? Purchase a Windows Server 2012 R2 license, copy my invalid files to a NAS share with NFS on a UNIX or Linux system, and have a go at the Windows registry and Server for NFS? Yeah... you're right, it's probably a bit over the top...
    On a second thought... I might as well install Linux again. There are countless situations where Linux has helped me solve problems related to, and more often than not caused by Windows.

    Essentially, Linux created some files with colons (:) in the name on a NTFS partition where I have Windows installed. I have since uninstalled Linux, but now I can only view these files in Windows Explorer. I can't open them, I can't even rename them to
    correct the problem. It's as if they don't exist, because of the invalid search paths.
    If I try to rename them in Windows Explorer I get following message.
    The file name you specified is no valid or too long.
    Specify a different file name.
    Well isnt' that something?... isn't that nice? Windows is able to display these files, but it doesn't allow me to open them and it certainly doesn't like me to rename them. So why is it whining about it then, when I'm trying to help? It says "try a different
    file name". Yeah, right! Like I haven't tried that one already! It doesn't matter what file name I input it will never accept it.
    So what am I supposed to do now? Ditch Windows and go back to Linux? Surely, Microsoft doesn't like the sound of that. Sure, I could reinstall Linux or run a Linux live system to correct the problem. But what good is Windows then? I might as well switch to
    Linux altogether.
    After doing some research I now know by fact that it's (kind of) possible to rename files from UNIX and UNIX-like operating systems to those compliant with Windows by using something called file name character translation. To some level this is essential and
    necessary for Windows interoperability with other operating systems (Windows is not the only operating system in the world). But this seems to be very complicated and I can't get my head around it. My brain is in overload. I don't know where to start.
    Once there was a...
    There's the Windows Services for UNIX (SFU) 1.0, 2.0, 3.0, 3.5. The first two versions were based on MKS Toolkit, a package licensed by Microsoft from MKS Inc. The later versions were based on the similar Interix product, after Microsoft purchased the company
    that made it.
    Then there's the new Subsystem for UNIX-based Applications (SUA). These are services for UNIX components. They are supposed to have Client for NFS v3 included as well. But the server components from the SFU line is missing (e.g. Server for NFS). These are included
    in Server editions of Windows.
    Then there's the Microsoft Knowledge Base article
    289627: "How to Enable File Name Character Translation". This article seems to describe exactly my situation.
    Windows and UNIX operating systems have restrictions on valid characters that can be used in a file name. The list of illegal characters for each operating system, however, is different. For example, a UNIX file name can use a colon (:), but a Windows
    file name cannot use a colon (:). If a UNIX user attempts to create a file with a Windows illegal character on a Windows Services for UNIX network file system (NFS) share, the attempt is unsuccessful and the UNIX client computer receives an input or output
    error.
    It goes further than that. At first glance, this KB article also seems to offer a solution to this exact problem, with examples as shown below.
    For example, the following maps the UNIX colon (:) to a Windows dash (-):
    0x3a : 0x2d ; replace client : with - on server
    I checked these values in charmap.exe and they are correct. Except for 2D not being a "dash", it's rather a hyphen ("hyphen minus" to be exact), but these two have pretty much the same appearance and they get interchanged a lot, I'm sure
    they are used to it by now. (Yes, the characters! They don't mind.)
    Then there's this registry key.
    HKEY_LOCAL_MACHINE\Software\Microsoft\Server For NFS\CurrentVersion\Mapping
    Well, of course, I don't have Server for NFS. So this is a dead end. Well, actually, it was a dead end from the beginning...
    1. First of all, I'm not working with a network share on a NAS or SAN storage. The files are on the local disk drive where Windows is installed, so that's a DAS for you.
    2. I don't have SFU! Well obviously, I'm on Windows Vista! So that means SUA!
    3. SUA are service components only. No server components. Can you guess what that means? Yeah... no "Server for NFS" since it's a server component.
    4. Windows Vista is a client side operating system! Server for NFS is only offered for use with Windows Server systems.
    5. Back to square one!
    So there you have it. They all lived happy for the rest of their lives...
    I'm stuck here. Can someone tell me what to do? I mean beyond the obvious option to use Linux to fixa a Windows problem? The NTFS file system itself supports colons in file names. It's Windows that doesn't, and so by default it proclaims it invalid character.
    Surely, even a Windows client operating system like Windows Vista should be able to allow the user to at least rename files with invalid characters to something more sensible (from the system point of view) and valid, if not being able to open them as they
    are. Just add some crazy voodoo code to it and it will work. If you can make it possible on Windows Server with UNIX user-mode subsystem on NT kernel, then what's stopping you from giving the Windows client system the same benefit?
    So what now? Purchase a Windows Server 2012 R2 license, copy my invalid files to a NAS share with NFS on a UNIX or Linux system, and have a go at the Windows registry and Server for NFS? Yeah... you're right, it's probably a bit over the top...
    On a second thought... I might as well install Linux again. There are countless situations where Linux has helped me solve problems related to, and more often than not caused by Windows.

  • Rename file name

    Hello to everyone,
    I need to change the old file name  for that I used this code ......but the problem here is..............
    normally I will get the file name is
    /interfaces/in/1601/payroll03052007
    directory
    /interfaces/in/1601                                                                 
    file name  is payroll03052007
    so the new file name starts with z ...like zpayroll03052007.....here the problem is...'z' should come before the file name.......for that how can I write the code.......
    form renamefile.                                                
       file-name-old(50) = jefile(50).                               
       v_date = sy-datum.                                            
       v_time = sy-uzeit.                                            
    concatenate: file-name-old '-' hrec-hpostdate(2) hrec-hpostdat
                                                    into file-name-
        concatenate: file-name-old  v_date v_time into file-name-new.
    Rename Input file to prevent second interface of data         
       refresh rctable.                                              
       call function 'Z_RENAME_FILE'                                 
            exporting                                                
                 source_file_name = file-name-old                    
                 target_file_name = file-name-new                    
            tables                                                   
                 rc_table         = rctable.                                                                               
    if sy-subrc = 0.                                              
         write:/  'Rename function sucessfully executed'.            
         write:/  'Renamed file from: ', file-name-old.              
         write:/  '               to: ', file-name-new.              
       else.                                                         
         write:/  'Z_Rename function could not be executed'.         
       endif.                                                        
    Thanks in advance....
    Madhu.

    You can use SXPG_COMMAND_EXECUTE. This function is used to execute operating system command and can be used to rename a operating system file. For example you can use "mv" on UNIX or "REN" on Windows systems.
    CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
      EXPORTING
        COMMANDNAME                         =
    *   ADDITIONAL_PARAMETERS               =
    *   OPERATINGSYSTEM                     = SY-OPSYS
    *   TARGETSYSTEM                        = SY-HOST
    *   DESTINATION                         =
    *   STDOUT                              = 'X'
    *   STDERR                              = 'X'
    *   TERMINATIONWAIT                     = 'X'
    *   TRACE                               =
    * IMPORTING
    *   STATUS                              =
    *   EXITCODE                            =
      TABLES
        EXEC_PROTOCOL                       =
    * EXCEPTIONS
    *   NO_PERMISSION                       = 1
    *   COMMAND_NOT_FOUND                   = 2
    *   PARAMETERS_TOO_LONG                 = 3
    *   SECURITY_RISK                       = 4
    *   WRONG_CHECK_CALL_INTERFACE          = 5
    *   PROGRAM_START_ERROR                 = 6
    *   PROGRAM_TERMINATION_ERROR           = 7
    *   X_ERROR                             = 8
    *   PARAMETER_EXPECTED                  = 9
    *   TOO_MANY_PARAMETERS                 = 10
    *   ILLEGAL_COMMAND                     = 11
    *   WRONG_ASYNCHRONOUS_PARAMETERS       = 12
    *   CANT_ENQ_TBTCO_ENTRY                = 13
    *   JOBCOUNT_GENERATION_ERROR           = 14
    *   OTHERS                              = 15
    COMMANDNAME is the logical name as defined in SXPGCOSTAB, maintained via SXPG_COMMAND_MAINTAIN function. For example you would assign ZMV for "mv" command for renaming file. In the ADDITIONAL_PARAMETERS you can given old file name and new file names

  • Open File dialog user can delete and rename files.

    Does any one know if there is a way to prevent a user from deleting and renaming files by right clicking on them in an Open File dialog box?

    Well, the problem is that this isn't a LV dialog box. It's the standard Windows file dialog box and this is the way they work in Windows.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

Maybe you are looking for

  • How do i set up iMessage on my Macbook Pro

    How do i set up iMessage on my macbook pro, all it shows is my apple id email address and i've tried 'Adding Email' as my number and it says an email has been sent although i do not recieve a text. I have no i dea how to set it up! Please help! <Pers

  • Display PDF in browser

    Hello, Can someone tell me more or less, how this options works? Is Adobe Reader still working as an ActiveX to be able to be embedded in a web browser? Or is this another way of doing it? Thank you

  • How to install Windows XP on MacBookPro

    How do I install Windows XP on my MacBookPro? Do I have to buy Windows XP or can I use the cd that came with my PC which has XP on it? Do I just put the cd in and follow the instructions?

  • Error in XSD Parsing - Imported XSD not being loaded

    I am trying to validate XML with XSD. The XML has elements in two different namespaces:- 1-"http://schemas.xmlsoap.org/soap/envelope/" 2-urn:Hotel_Reserve So in Schema I have defined elements Envelop, Header and Body in "http://schemas.xmlsoap.org/so

  • Problem with Excise duty Scenario

    Hi Experts     my Scenario is  ,  i am gieving PO say to vendor A , he is procuring material from vendor B , now the excise invoice  , given by vendor B is  forwarded by vendor A , but vendor A is increesing the basic value value of material Say A bu