Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFile::rename() folder fails by explorer
Forum Updated to NodeBB v4.3 + New Features

QFile::rename() folder fails by explorer

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 850 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    samdol
    wrote on last edited by samdol
    #1

    Hi,
    I used QFile::rename(old_foldername, new_foldername) to rename folder in windows. It works ok. But when if file explorer open subfolder of old_foldername, it fails to rename folder. For example, if old_foldername is "C:\myfolder" and if windows file explorer open the foder "C:\myfoder\subfolder", then it could not rename "C:\myfolder" to another name.
    On the other hand, other windows application could rename it without problem. Is it possible to fix it?

    kshegunovK 1 Reply Last reply
    0
    • S samdol

      Hi,
      I used QFile::rename(old_foldername, new_foldername) to rename folder in windows. It works ok. But when if file explorer open subfolder of old_foldername, it fails to rename folder. For example, if old_foldername is "C:\myfolder" and if windows file explorer open the foder "C:\myfoder\subfolder", then it could not rename "C:\myfolder" to another name.
      On the other hand, other windows application could rename it without problem. Is it possible to fix it?

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @samdol said in QFile::rename() folder fails by explorer:

      On the other hand, other windows application could rename it without problem. Is it possible to fix it?

      I'm pretty sure that's not true. Please check again. On windows applications (in this case) explorer lock the folders when they open them, so that's why your Qt app is not able to rename the file. It's an OS's filesystem's limitation, and I'm not aware of any workarounds.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved