Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9233947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:40:26+00:00 2026-06-18T06:40:26+00:00

I want to save my files within a folder but the issue which raising

  • 0

I want to save my files within a folder but the issue which raising is that my files are storing outside of the folder which is annoying. I am sharing what I have done so far.

-- get raw path to app's Temporary directory
local doc_path = system.pathForFile( "", system.DocumentsDirectory )

-- change current working directory
local success = lfs.chdir( doc_path ) -- returns true on success
local new_folder_path

if success then
lfs.mkdir( "MyNewFolder" )
new_folder_path = lfs.currentdir() .. "/MyNewFolder"
end

local filePath = system.pathForFile( dataFileName , new_folder_path )
r = media.newRecording(filePath)
--print("new recording has been started with a name"..dataFileName)
r:startRecording()

but my recorded file is out of this newly created folder
can someone help me here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:40:27+00:00Added an answer on June 18, 2026 at 6:40 am

    I searched out and finally got the answer that the problem.This is how to create a new recording in specified folder

    r = media.newRecording( new_folder_path.."/"..dataFileName )
    

    This line would automatically create a file in this folder as mentioned in the question.
    system.pathForFile() only creates a file automatically when the second argument is a base directory like system.DocumentsDirectory (as it is clearly mentioned in the documentation that the second argument is constant and it should be only any base directory).
    so if you want to create a new file r want to find the path of the file you would append folder name before the file name like my folder/my file
    Hope this would help

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to save files which will have name with danish characters, for example
in my application, I have pdf files. I want to save those pdf files
i want to save an .XML file that i create with php dom, but
I have some files uploaded at a filehoster which I want to download programmatically,
I have a Maven repository that has jar files I want to use locally
I want to save the my tab delim files manually. I mean that I
I'm trying to save Excel files into the database, I do not want to
In my app, I open the camera and want to save that file with
I want to save a remote img-file to my server, but I don't know
I want to extract the files within a ZIP file I uploaded to my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.