The program can't stop when searches over all files under folders and subfolders

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The program can't stop when searches over all files under folders and subfolders

miao
Hi,

  I tried to convert all wma file to mp3 by av library and then I delete
the wma file. Even after all files are converted to mp3, the program is
still running. Is there anything wrong in this program?


################
library(av)

all_files <- list.files(path = ".", pattern = '*.wma', all.files = FALSE,
           full.names = FALSE, recursive = TRUE,
           ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE)

for(i in all_files)
{
  av_audio_convert(
    audio = i,
    output = gsub(".wma", ".mp3", i),
    format = NULL,
    channels = NULL,
    sample_rate = NULL,
    start_time = NULL,
    total_time = NULL,
    verbose = TRUE
  )
  file.remove(i)
}

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: The program can't stop when searches over all files under folders and subfolders

Jim Lemon-4
Hi John,
If the program is still running, I can only guess that the function is
not exiting properly. If this happened to me, I would run "top" in a
terminal window and see if that process number was actually doing
anything or had gone zombie.

Jim

On Tue, Apr 20, 2021 at 11:28 AM John <[hidden email]> wrote:

>
> Hi,
>
>   I tried to convert all wma file to mp3 by av library and then I delete
> the wma file. Even after all files are converted to mp3, the program is
> still running. Is there anything wrong in this program?
>
>
> ################
> library(av)
>
> all_files <- list.files(path = ".", pattern = '*.wma', all.files = FALSE,
>            full.names = FALSE, recursive = TRUE,
>            ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE)
>
> for(i in all_files)
> {
>   av_audio_convert(
>     audio = i,
>     output = gsub(".wma", ".mp3", i),
>     format = NULL,
>     channels = NULL,
>     sample_rate = NULL,
>     start_time = NULL,
>     total_time = NULL,
>     verbose = TRUE
>   )
>   file.remove(i)
> }
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: The program can't stop when searches over all files under folders and subfolders

Rui Barradas
Hello,

The following will probably not solve the problem but I would

1. use pattern = "\\.wma$" in list.files;
2. use sub, not gsub, in

sub("\\.wma$", ".mp3", i)


Hope this helps,

Rui Barradas

Às 05:29 de 20/04/21, Jim Lemon escreveu:

> Hi John,
> If the program is still running, I can only guess that the function is
> not exiting properly. If this happened to me, I would run "top" in a
> terminal window and see if that process number was actually doing
> anything or had gone zombie.
>
> Jim
>
> On Tue, Apr 20, 2021 at 11:28 AM John <[hidden email]> wrote:
>>
>> Hi,
>>
>>    I tried to convert all wma file to mp3 by av library and then I delete
>> the wma file. Even after all files are converted to mp3, the program is
>> still running. Is there anything wrong in this program?
>>
>>
>> ################
>> library(av)
>>
>> all_files <- list.files(path = ".", pattern = '*.wma', all.files = FALSE,
>>             full.names = FALSE, recursive = TRUE,
>>             ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE)
>>
>> for(i in all_files)
>> {
>>    av_audio_convert(
>>      audio = i,
>>      output = gsub(".wma", ".mp3", i),
>>      format = NULL,
>>      channels = NULL,
>>      sample_rate = NULL,
>>      start_time = NULL,
>>      total_time = NULL,
>>      verbose = TRUE
>>    )
>>    file.remove(i)
>> }
>>
>>          [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.